Chris Lattner
2178a80b90
move DecomposeGEPExpression out into ValueTracking.cpp
...
llvm-svn: 89956
2009-11-26 17:12:50 +00:00
Chris Lattner
d86a693b70
teach GetLinearExpression to be a bit more aggressive.
...
llvm-svn: 89955
2009-11-26 17:00:01 +00:00
Chris Lattner
62a36a703c
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
9c88c96b3f
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
677b93d4c8
teach basicaa that A[i] != A[i+1].
...
llvm-svn: 89951
2009-11-26 16:18:10 +00:00
Chris Lattner
69e59e50f3
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
bd90980add
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
Chris Lattner
57bca7101d
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
260350330e
Use GEPOperator more pervasively to simplify code.
...
llvm-svn: 89914
2009-11-26 02:11:08 +00:00
Chris Lattner
23bebfe8d5
fix comment, thanks all :)
...
llvm-svn: 89666
2009-11-23 17:07:35 +00:00
Chris Lattner
1637c0e720
use the new isNoAlias method to simplify some code, only do an escaping check if
...
we have a non-constant pointer. Constant pointers can't be local.
llvm-svn: 89665
2009-11-23 16:46:41 +00:00
Chris Lattner
29221ce8d7
whitespace cleanup, tidying
...
llvm-svn: 89664
2009-11-23 16:45:27 +00:00
Chris Lattner
faf117b46b
speed up BasicAA a bit by implementing a long-standing TODO.
...
llvm-svn: 89663
2009-11-23 16:44:43 +00:00
Chris Lattner
73422d2e9b
add fixme for dubious code. Duncan, what do you think?
...
llvm-svn: 89602
2009-11-22 16:16:48 +00:00
Chris Lattner
632f60ccc9
remove a silly condition that doesn't make a lot of sense anymore.
...
llvm-svn: 89601
2009-11-22 16:15:59 +00:00
Chris Lattner
59be5d3703
reduce indentation, no functionality change.
...
llvm-svn: 89600
2009-11-22 16:05:05 +00:00
Chris Lattner
b6ecd40652
Remove the AliasAnalysis::getMustAliases method, which is dead.
...
The hasNoModRefInfoForCalls isn't worth it as a filter because
basicaa provides m/r info and everything chains to it, so remove
it.
llvm-svn: 89599
2009-11-22 16:01:44 +00:00
Dan Gohman
44ddc50043
Extend CaptureTracking to indicate when a value is never stored, even
...
if it is not ultimately captured. Teach BasicAliasAnalysis that a
local object address which does not escape and is never stored does
not alias with a value resulting from a load.
llvm-svn: 89398
2009-11-19 21:57:48 +00:00
Nick Lewycky
fba1efd298
Teach BasicAA that a constant expression can't alias memory provably not
...
allocated until runtime (such as an alloca). Patch by Hans Wennborg!
llvm-svn: 88760
2009-11-14 06:15:14 +00:00
Dan Gohman
6780148e20
Default-addressspace null pointers don't alias anything. This allows
...
GVN to be more aggressive. Patch by Hans Wennborg! (with a comment added by me)
llvm-svn: 86582
2009-11-09 19:29:11 +00:00
Chris Lattner
903ae55e1c
remove a bunch of extraneous LLVMContext arguments
...
from various APIs, addressing PR5325.
llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Victor Hernandez
0f662a7acf
Rename MallocFreeHelper as MemoryBuiltins
...
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Victor Hernandez
6c86b93663
Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
...
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Dan Gohman
c8468855a7
Teach BasicAA how to analyze Select instructions, and make it more
...
aggressive on PHI instructions.
llvm-svn: 85158
2009-10-26 21:55:43 +00:00
Nick Lewycky
2b8400628d
Remove includes of Support/Compiler.h that are no longer needed after the
...
VISIBILITY_HIDDEN removal.
llvm-svn: 85043
2009-10-25 06:57:41 +00:00
Nick Lewycky
711c726c97
Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
...
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.
llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Victor Hernandez
8428eb5720
Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
...
llvm-svn: 84969
2009-10-23 21:09:37 +00:00
Chris Lattner
a72ccc6fee
inline isGEP away.
...
llvm-svn: 84373
2009-10-17 23:48:54 +00:00
Evan Cheng
54b34ff68d
When checking aliases between phi sources and V2, we know the sources are not themselves phi nodes. However, V2 may be. Call aliasCheck with V2 first to potentially eliminate a std::swap call.
...
llvm-svn: 84226
2009-10-16 00:33:09 +00:00
Nick Lewycky
7ec7f1ce0f
Add missing break statements! Thanks to Duncan Sands for pointing this out!
...
llvm-svn: 84191
2009-10-15 18:48:58 +00:00
Nick Lewycky
4ba7b77812
Teach basicaa about memcpy/memmove/memset. The length argument can be used to
...
improve alias results if constant, and the source pointer can't be modified.
llvm-svn: 84175
2009-10-15 07:11:24 +00:00
Nick Lewycky
14a06f7051
Teach BasicAA to use the size parameter of the memory use marker intrinsics.
...
llvm-svn: 84174
2009-10-15 06:12:11 +00:00
Nick Lewycky
a12f6e8f78
Take advantage of TargetData when available; we know that the atomic intrinsics
...
only dereference the element they point to directly with no pointer arithmetic.
llvm-svn: 84159
2009-10-15 00:36:35 +00:00
Evan Cheng
37a7a18748
Clear VisitedPHIs after use.
...
llvm-svn: 84080
2009-10-14 06:46:26 +00:00
Evan Cheng
907fd9c3fb
Another BasicAA fix. If a value does not alias a GEP's base pointer, then it
...
cannot alias the GEP. GEP pointer alias rule states this clearly:
A pointer value formed from a getelementptr instruction is associated with the
addresses associated with the first operand of the getelementptr.
llvm-svn: 84079
2009-10-14 06:41:49 +00:00
Evan Cheng
c1056d9269
More code clean up based on patch feedback.
...
llvm-svn: 84074
2009-10-14 05:22:03 +00:00
Evan Cheng
efc0f806a4
Change VisitedPHIs into an instance variable that's freed by each alias() call.
...
llvm-svn: 84072
2009-10-14 05:05:02 +00:00
Evan Cheng
3130aba687
Teach basic AA about PHI nodes. If all operands of a phi NoAlias another value than it's safe to declare the PHI NoAlias the value. Ditto for MustAlias.
...
llvm-svn: 84038
2009-10-13 22:02:20 +00:00
Evan Cheng
84c5224fa2
Refactor some code. No functionality changes.
...
llvm-svn: 84000
2009-10-13 18:42:04 +00:00
Nick Lewycky
72f185f281
Teach BasicAA a little something about the atomic intrinsics: they can only
...
modify through the pointer they're given.
llvm-svn: 83959
2009-10-13 07:48:38 +00:00
Victor Hernandez
66d4042178
Enhance analysis passes so that they apply the same analysis to malloc calls as to MallocInst.
...
Reviewed by Eli Friedman.
llvm-svn: 82281
2009-09-18 21:34:51 +00:00
Dan Gohman
335b36bf14
Use stripPointerCasts instead of doing the same manually.
...
llvm-svn: 80267
2009-08-27 18:02:03 +00:00
Owen Anderson
9df206d02d
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Owen Anderson
1dc40e205b
Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
...
metadata related, which I'm waiting on to avoid conflicting with Devang.
llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Owen Anderson
0ce2151b36
Move ConstantExpr to 2.5 API.
...
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Dan Gohman
acc5d6eaae
Make AliasAnalysis and related classes use
...
getAnalysisIfAvailable<TargetData>().
llvm-svn: 77028
2009-07-25 00:48:42 +00:00
Owen Anderson
cc33e89571
Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
...
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Owen Anderson
cc287b28c9
Get rid of the Pass+Context magic.
...
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Dan Gohman
00b05492f1
Revert the addition of hasNoPointerOverflow to GEPOperator.
...
Getelementptrs that are defined to wrap are virtually useless to
optimization, and getelementptrs that are undefined on any kind
of overflow are too restrictive -- it's difficult to ensure that
all intermediate addresses are within bounds. I'm going to take
a different approach.
Remove a few optimizations that depended on this flag.
llvm-svn: 76437
2009-07-20 17:43:30 +00:00
Dan Gohman
93cbd452ed
Make BasicAliasAnalysis and Value::getUnderlyingObject use
...
GEPOperator's hasNoPointer0verflow(), and make a few places in instcombine
that create GEPs that may overflow clear the NoOverflow value. Among
other things, this partially addresses PR2831.
llvm-svn: 76252
2009-07-17 22:25:10 +00:00