Nick Lewycky
d801c10de6
Teach memdep to look for memory use intrinsics during dependency queries. Fixes
...
PR5574.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90045 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28 21:27:49 +00:00
Chris Lattner
dd696052f0
Enhance InsertPHITranslatedPointer to be able to return a list of newly
...
inserted instructions. No functionality change until someone starts using it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90039 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28 15:39:14 +00:00
Chris Lattner
ab9530ee5d
implement a FIXME: limit the depth that DecomposeGEPExpression goes the same
...
way that getUnderlyingObject does it.
This fixes the 'DecomposeGEPExpression and getUnderlyingObject disagree!'
assertion on sqlite3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28 15:12:41 +00:00
Chris Lattner
af7a28939e
enable code to handle un-phi-translatable cases more aggressively:
...
if we don't have an address expression available in a predecessor,
then model this as the value being clobbered at the end of the pred
block instead of being modeled as a complete phi translation failure.
This is important for PRE of loads because we want to see that the
load is available in all but this predecessor, and complete phi
translation failure results in not getting any information about
predecessors.
This doesn't do anything until I renable code insertion since PRE
now sees that it is available in all but one predecessors, but can't
insert the addressing in the predecessor that is missing it to
eliminate the redundancy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90037 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28 14:54:10 +00:00
Chris Lattner
6f7b210b25
Rework InsertPHITranslatedPointer to handle the recursive case, this
...
fixes PR5630 and sets the stage for the next phase of goodness (testcase
pending).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 22:05:15 +00:00
Chris Lattner
5141421e38
recursively phi translate bitcast operands too, for consistency.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 20:25:30 +00:00
Chris Lattner
11c6bab704
add support for recursive phi translation and phi
...
translation of add with immediate. This allows us
to optimize this function:
void test(int N, double* G) {
long j;
G[1] = 1;
for (j = 1; j < N - 1; j++)
G[j+1] = G[j] + G[j+1];
}
to only do one load every iteration of the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 19:11:31 +00:00
Chris Lattner
8aee8efc0c
factor some logic out of instcombine into a new SimplifyAddInst method.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90011 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 17:42:22 +00:00
Chris Lattner
9763487bd5
add comment.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90002 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 08:40:14 +00:00
Chris Lattner
e95035aea4
reduce nesting, no functionality change.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90001 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 08:37:22 +00:00
Chris Lattner
a650f770d4
limit the recursion depth of GetLinearExpression. This
...
fixes a crash analyzing consumer-lame, which had an "%X = add %X, 1"
in unreachable code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90000 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 08:32:52 +00:00
Chris Lattner
616613d7a4
teach GVN's load PRE to insert computations of the address in predecessors
...
where it is not available. It's unclear how to get this inserted
computation into GVN's scalar availability sets, Owen, help? :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 08:25:10 +00:00
Chris Lattner
62deff066c
Fix phi translation in load PRE to agree with the phi
...
translation done by memdep, and reenable gep translation
again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 06:31:14 +00:00
Chris Lattner
b99be5beac
redisable this, my bootstrap worked because it wasn't an optimized build, whoops.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 05:53:01 +00:00
Chris Lattner
cca130bb66
try again.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 05:19:56 +00:00
Chris Lattner
518c988ae9
this is causing buildbot failures, disable for now.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 01:52:22 +00:00
Chris Lattner
e19e4baf3b
teach phi translation of GEPs to simplify geps like 'gep x, 0'.
...
This allows us to compile the example from PR5313 into:
LBB1_2: ## %bb
incl %ecx
movb %al, (%rsi)
movslq %ecx, %rax
movb (%rdi,%rax), %al
testb %al, %al
jne LBB1_2
instead of:
LBB1_2: ## %bb
movslq %eax, %rcx
incl %eax
movb (%rdi,%rcx), %cl
movb %cl, (%rsi)
movslq %eax, %rcx
cmpb $0, (%rdi,%rcx)
jne LBB1_2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89981 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 00:34:38 +00:00
Chris Lattner
c514c1f521
factor some instcombine simplifications for getelementptr out to a new
...
SimplifyGEPInst method in InstructionSimplify.h. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 00:29:05 +00:00
Chris Lattner
304076268a
teach memdep to do trivial PHI translation of GEPs. More to
...
come.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89979 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 00:07:37 +00:00
Chris Lattner
cc3d0eb483
Teach memdep to phi translate bitcasts. This allows us to compile
...
the example in GCC PR16799 to:
LBB1_2: ## %bb1
movl %eax, %eax
subq %rax, %rdi
movq %rdi, (%rcx)
movl (%rdi), %eax
testl %eax, %eax
je LBB1_2
instead of:
LBB1_2: ## %bb1
movl (%rdi), %ecx
subq %rcx, %rdi
movq %rdi, (%rax)
cmpl $0, (%rdi)
je LBB1_2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89978 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 23:41:07 +00:00
Chris Lattner
dc59311c5c
factor some code out into some helper functions.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89975 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 23:18:49 +00:00
Chris Lattner
1ce0eaa25f
Implement PR1143 (at -m64) by making basicaa look through extensions. We
...
previously already handled it at -m32 because there were no i32->i64
extensions for addressing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 18:53:33 +00:00
Chris Lattner
b18004c13c
fix two transposed lines duncan caught and add an explanatory comment.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89958 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 18:35:46 +00:00
Chris Lattner
8fe8ac725b
this todo is resolved.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89957 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 17:14:10 +00:00
Chris Lattner
e405c64f6b
move DecomposeGEPExpression out into ValueTracking.cpp
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89956 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 17:12:50 +00:00
Chris Lattner
fa3966881f
teach GetLinearExpression to be a bit more aggressive.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 17:00:01 +00:00
Chris Lattner
5369250b73
resolve a fixme. I haven't figured out how to write a testcase
...
to exercise this though.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89954 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 16:52:32 +00:00
Chris Lattner
5d5261c819
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 16:26:43 +00:00
Chris Lattner
f6ac4d9dad
teach basicaa that A[i] != A[i+1].
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89951 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 16:18:10 +00:00
Chris Lattner
d84eb911a9
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.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 02:17:34 +00:00
Chris Lattner
23e2a5b2ff
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.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89920 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 02:14:59 +00:00
Chris Lattner
4e91ee7a2a
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).
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 02:13:03 +00:00
Chris Lattner
539c9b99c2
Use GEPOperator more pervasively to simplify code.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89914 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 02:11:08 +00:00
Chris Lattner
11fe72661d
remove some redundant braces
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89912 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 01:50:12 +00:00
Devang Patel
65dbc909f5
Use StringRef (again) in DebugInfo interface.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89866 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 17:36:49 +00:00
Devang Patel
193f720f11
Emit pubtypes.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89725 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 01:14:22 +00:00
Jim Grosbach
dbc3577ea1
enable iv-users simplification by default
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89713 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 23:25:54 +00:00
Devang Patel
e54a5e88a5
Add CreateLocation varinat that accepts MDNode (with a default value).
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89689 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 19:11:20 +00:00
Chris Lattner
b27db37ed0
fix comment, thanks all :)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89666 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 17:07:35 +00:00
Chris Lattner
403ac2ece3
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89665 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 16:46:41 +00:00
Chris Lattner
5d56b2d47d
whitespace cleanup, tidying
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89664 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 16:45:27 +00:00
Chris Lattner
b34b82e9d1
speed up BasicAA a bit by implementing a long-standing TODO.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 16:44:43 +00:00
Dan Gohman
01b97dd01e
Make ConstantFoldConstantExpression recursively visit the entire
...
ConstantExpr, not just the top-level operator. This allows it to
fold many more constants.
Also, make GlobalOpt call ConstantFoldConstantExpression on
GlobalVariable initializers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89659 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 16:22:21 +00:00
Nick Lewycky
ae3d802953
Remove unused LLVMContext.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 03:29:18 +00:00
Nick Lewycky
c6501b13c0
Remove dead LLVMContext argument.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89641 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 03:26:09 +00:00
Chris Lattner
6c7276f17e
add fixme for dubious code. Duncan, what do you think?
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 16:16:48 +00:00
Chris Lattner
4723303c97
remove a silly condition that doesn't make a lot of sense anymore.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 16:15:59 +00:00
Chris Lattner
92e803c2a4
reduce indentation, no functionality change.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89600 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 16:05:05 +00:00
Chris Lattner
66e08cf79a
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89599 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 16:01:44 +00:00
Nick Lewycky
f27f115ef5
Remove dead code. While there, also turn a few 'T* ' into 'T *' to match the
...
rest of the file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 02:38:11 +00:00