Commit Graph

73003 Commits

Author SHA1 Message Date
Chris Lattner 29f82a1465 move DecomposeGEPExpression out into ValueTracking.cpp
llvm-svn: 89956
2009-11-26 17:12:50 +00:00
Chris Lattner 631c5b2cb9 teach GetLinearExpression to be a bit more aggressive.
llvm-svn: 89955
2009-11-26 17:00:01 +00:00
Chris Lattner 5c1cfc252c resolve a fixme. I haven't figured out how to write a testcase
to exercise this though.

llvm-svn: 89954
2009-11-26 16:52:32 +00:00
Chris Lattner ba0014a44c update status of this. basicaa is much improved now,
only missing the one form (in this testcase).  Dan, do you
consider this example to be important?

llvm-svn: 89953
2009-11-26 16:42:00 +00:00
Chris Lattner 29bc8a91d3 Teach basicaa that x|c == x+c when the c bits of x are clear. This
allows us to compile the example in readme.txt into:

LBB1_1:                                                     ## %bb
	movl	4(%rdx,%rax), %ecx
	movl	%ecx, %esi
	imull	(%rdx,%rax), %esi
	imull	%esi, %ecx
	movl	%esi, 8(%rdx,%rax)
	imull	%ecx, %esi
	movl	%ecx, 12(%rdx,%rax)
	movl	%esi, 16(%rdx,%rax)
	imull	%ecx, %esi
	movl	%esi, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

instead of:

LBB1_1: 
	movl	(%rdx,%rax), %ecx
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 8(%rdx,%rax)
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 12(%rdx,%rax)
	imull	8(%rdx,%rax), %ecx
	movl	%ecx, 16(%rdx,%rax)
	imull	12(%rdx,%rax), %ecx
	movl	%ecx, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

GCC (4.2) doesn't seem to be able to eliminate the loads in this 
testcase either, it generates:

L2:
	movl	(%rdx), %eax
	imull	4(%rdx), %eax
	movl	%eax, 8(%rdx)
	imull	4(%rdx), %eax
	movl	%eax, 12(%rdx)
	imull	8(%rdx), %eax
	movl	%eax, 16(%rdx)
	imull	12(%rdx), %eax
	movl	%eax, 20(%rdx)
	addl	$4, %ecx
	addq	$16, %rdx
	cmpl	$1002, %ecx
	jne	L2

llvm-svn: 89952
2009-11-26 16:26:43 +00:00
Chris Lattner 12dacdd359 teach basicaa that A[i] != A[i+1].
llvm-svn: 89951
2009-11-26 16:18:10 +00:00
Chris Lattner 453751031a rename test
llvm-svn: 89950
2009-11-26 16:08:41 +00:00
Gabor Greif d2add35d9d typo
llvm-svn: 89949
2009-11-26 15:18:50 +00:00
Gabor Greif 40762fec73 issue a friendlier error if someone tries to send precompiled header to '-' (stdout)
this brings the error on
  clang -c foo.h -o -
closer to
  clang -c foo.h -o /dev/null

llvm-svn: 89948
2009-11-26 14:35:28 +00:00
Benjamin Kramer 334af99964 Remove dead forward declaration. Fix struct/class mismatch. Remove trailing whitespace.
llvm-svn: 89947
2009-11-26 13:09:03 +00:00
Daniel Dunbar 7ab5c491c1 Remove header which is bringing libAST in (on MSVC).
llvm-svn: 89946
2009-11-26 09:57:25 +00:00
Eli Friedman 4907c6f2ed Remove unused variable.
llvm-svn: 89945
2009-11-26 07:48:44 +00:00
Eli Friedman ffc066f4b9 Shortcut explicit calls to a trivial copy assignment operator.
llvm-svn: 89944
2009-11-26 07:45:48 +00:00
Eli Friedman 84a7e347bf Simplify and fix up the handling of implicit constructors, copy assignment
operators, and destructors.  Avoids generating declarations/definitions of
trivial constructors/destructors, and makes sure the trivial copy assignment
operator is generated when necessary.

llvm-svn: 89943
2009-11-26 07:40:08 +00:00
Ted Kremenek 2350e0c3ba Improve diagnostics in ReturnStackAddressChecker for returning a stack-allocated block. Implements the rest of <rdar://problem/7387385>.
llvm-svn: 89940
2009-11-26 07:14:50 +00:00
Ted Kremenek e5d8dd808e Add test case that shows that dead stores checking now works in the presence of blocks.
llvm-svn: 89939
2009-11-26 06:55:36 +00:00
Eli Friedman d15eb34d4b Implement IRGen for MemberExpr referring to static member function.
llvm-svn: 89938
2009-11-26 06:08:14 +00:00
Daniel Dunbar 0ec57ff203 Don't run the LLVM Code tests by default.
llvm-svn: 89937
2009-11-26 05:09:00 +00:00
Daniel Dunbar 9acb35a5e8 Add -Werror for Clang and LLVM on Clang (headers) syntax tests.
llvm-svn: 89936
2009-11-26 05:08:53 +00:00
Anders Carlsson 6d771bcd09 Add a Thunk struct to the vtable builder.
llvm-svn: 89935
2009-11-26 03:25:13 +00:00
Eli Friedman cb422f1dbe Use the more general Evaluate infrastructure for folding constant DeclRefs
instead of checking explicitly for an EnumConstantDecl.  This folds references
to constant integer VarDecls, which has two benefits:

1. Slightly smaller emitted code from emitting a constant instead of a load,
and skipping emitting some constant globals.
2. Some code forgets to define static constant member variables; emitting a
load instead of the value in that case leads to a link error. (Such programs
are technically not well-formed, but in practice build with g++.)

llvm-svn: 89934
2009-11-26 03:22:21 +00:00
Anders Carlsson 2f87c4f1a5 Add a CovariantThunkAdjustment struct that represents the adjustments needed for a covariant thunk.
llvm-svn: 89933
2009-11-26 03:09:37 +00:00
Eli Friedman f873c2fb68 Slight tweak to the algorithm for getLinkage().
llvm-svn: 89932
2009-11-26 03:04:01 +00:00
Eli Friedman 8a5f75ed5d Use new getLinkage() method to correctly compute whether a variable has
internal linkage.  Fixes PR5433.

llvm-svn: 89931
2009-11-26 02:52:12 +00:00
Anders Carlsson abe274a8b0 Move the mangler into the CodeGen namespace. Change mangleThunk to take a ThunkAdjustment.
llvm-svn: 89930
2009-11-26 02:49:32 +00:00
Ted Kremenek f89dcdaf19 Add a PostVisitBlockExpr() method to RetainReleaseChecker to query for
the set of variables "captured" by a block.  Until the analysis gets
more sophisticated, for now we stop the retain count tracking of any
objects (transitively) referenced by these variables.

llvm-svn: 89929
2009-11-26 02:38:19 +00:00
Ted Kremenek 94f8c4a7d5 Teach RegionStoreManager::RemoveDeadBindings() about BlockDataRegions. Any VarRegion for a "captured" variable should also be considered live.
llvm-svn: 89928
2009-11-26 02:35:42 +00:00
Ted Kremenek 3378b610ae Add iterators to BlockDataRegion that allow clients to iterate over the VarRegions for "captured" variables for a block.
llvm-svn: 89927
2009-11-26 02:34:36 +00:00
Ted Kremenek 705fd953ef Added batch versions of GRState::scanReachableSymbols() so that clients can scan a collection of SVals or MemRegions all at once.
llvm-svn: 89926
2009-11-26 02:32:19 +00:00
Anders Carlsson c778540f9a Add a ThunkAdjustment struct which holds a non-virtual and a virtual adjustment offset. Start using it. General cleanup in Mangle.cpp.
llvm-svn: 89925
2009-11-26 02:32:05 +00:00
Ted Kremenek 0f5e6f8805 Enhance LiveVariables to understand that blocks can extend the liveness of a variable by "capturing" them in a BlockExpr.
This required two changes:

1) Added 'getReferencedgetReferencedBlockVars()' to AnalysisContext so
that clients can iterate over the "captured" variables in a block.

2) Modified LiveVariables to take an AnalysisContext& in its
constructor and to call getReferencedgetReferencedBlockVars() when it
processes a BlockExpr*.

llvm-svn: 89924
2009-11-26 02:31:33 +00:00
Douglas Gregor 20d58fbd3a Add C++ tests to try to parse and compile the LLVM libraries
llvm-svn: 89923
2009-11-26 02:28:53 +00:00
Chris Lattner 7a5b56aca9 Change the other half of aliasGEP (which handles GEP differencing) to use DecomposeGEPExpression. This dramatically simplifies and shrinks the code by eliminating the horrible CheckGEPInstructions method, fixes a miscompilation (@test3) and makes the code more aggressive. In particular, we now handle the @test4 case, which is reduced from the SmallPtrSet constructor. Missing this caused us to emit a variable length memset instead of a fixed size one.
llvm-svn: 89922
2009-11-26 02:17:34 +00:00
Chris Lattner 0d23076adf add a new random feature test
llvm-svn: 89921
2009-11-26 02:16:28 +00:00
Chris Lattner 5341c9679d Generalize DecomposeGEPExpression to exactly handle what Value::getUnderlyingObject does (when TD is around). This allows us to avoid calling DecomposeGEPExpression unless the ultimate alias check we care about passes, speedup up BasicAA a bit.
llvm-svn: 89920
2009-11-26 02:14:59 +00:00
Daniel Dunbar e0d81f2237 Factor out a LangStandard class and coalesce the information about the standards into LangStandards.def
- I'd appreciate another pair of eyeballs to double check this.

llvm-svn: 89919
2009-11-26 02:14:31 +00:00
Daniel Dunbar 5337f0c842 Fix thinko (-fno-builtin != -nobuiltininc).
llvm-svn: 89918
2009-11-26 02:14:16 +00:00
Daniel Dunbar 81fe60b787 Add clang -cc1 parsing for preprocessor options.
llvm-svn: 89917
2009-11-26 02:14:07 +00:00
Daniel Dunbar cbc693579c Add clang -cc1 parsing for header search options.
llvm-svn: 89916
2009-11-26 02:13:54 +00:00
Chris Lattner 8928899413 Implement a new DecomposeGEPExpression method, which decomposes a GEP into a list of scaled offsets. Use this to eliminate some previous ad-hoc code which was subtly broken (it assumed all Constant*'s were non-zero, but strange constant express could be zero).
llvm-svn: 89915
2009-11-26 02:13:03 +00:00
Chris Lattner a99edbedd1 Use GEPOperator more pervasively to simplify code.
llvm-svn: 89914
2009-11-26 02:11:08 +00:00
Chris Lattner 8e09ad6f3c update some notes slightly
llvm-svn: 89913
2009-11-26 01:51:18 +00:00
Chris Lattner 4f0b47d9e7 remove some redundant braces
llvm-svn: 89912
2009-11-26 01:50:12 +00:00
Douglas Gregor ff790f15c4 Refactor our handling of expression evaluation contexts, so that Sema
maintains a stack of evaluation contexts rather than having the parser
do it. This change made it simpler to track in which contexts
temporaries were created, so that we could...

"Forget" about temporaries created within unevaluated contexts, so
that we don't build a CXXExprWithTemporaries and, therefore, destroy
the integral-constness of our expressions. Fixes PR5609.

llvm-svn: 89908
2009-11-26 00:44:06 +00:00
Evan Cheng a4c986cbdd Test for 89905.
llvm-svn: 89906
2009-11-26 00:35:01 +00:00
Evan Cheng 595a16300c When all defs of a vr are implicit_def, delete all of the defs.
llvm-svn: 89905
2009-11-26 00:32:36 +00:00
Bob Wilson 2d4ff12da9 Split tail duplication into a separate pass. This is needed to avoid
running tail duplication when doing branch folding for if-conversion, and
we also want to be able to run tail duplication earlier to fix some
reg alloc problems.  Move the CanFallThrough function from BranchFolding
to MachineBasicBlock so that it can be shared by TailDuplication.

llvm-svn: 89904
2009-11-26 00:32:21 +00:00
Ted Kremenek 1646cf6d05 Add missing case in switch statement.
llvm-svn: 89903
2009-11-25 23:58:21 +00:00
Ted Kremenek b63ad7a6c1 Refine MemRegions for blocks. Add a new region called
'BlockDataRegion' to distinguish between the code associated with a
block (which is represented by 'BlockTextRegion') and an instance of a
block, which includes both code and data.  'BlockDataRegion' has an
associated LocationContext, which can be used to eventually model the
lifetime of a block object once LocationContexts can represent scopes
(and iterations around a loop, etc.).

llvm-svn: 89900
2009-11-25 23:53:07 +00:00
Dale Johannesen 979ac9fce4 Test for llvm-gcc checkin 89898.
llvm-svn: 89899
2009-11-25 23:50:09 +00:00