diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-26 16:26:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-26 16:26:43 +0000 |
commit | 5d5261c819fa2a203dc8d09c7bb71e041a12cd69 (patch) | |
tree | c5c1b47626ed98d5afe1bf01616fb4a2aceccc9a /test/Analysis | |
parent | f6ac4d9dadaa62959e04a0281e3bc5f4270fc260 (diff) | |
download | external_llvm-5d5261c819fa2a203dc8d09c7bb71e041a12cd69.zip external_llvm-5d5261c819fa2a203dc8d09c7bb71e041a12cd69.tar.gz external_llvm-5d5261c819fa2a203dc8d09c7bb71e041a12cd69.tar.bz2 |
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
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/BasicAA/gep-alias.ll | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Analysis/BasicAA/gep-alias.ll b/test/Analysis/BasicAA/gep-alias.ll index 0c5f7ac..320c990 100644 --- a/test/Analysis/BasicAA/gep-alias.ll +++ b/test/Analysis/BasicAA/gep-alias.ll @@ -86,4 +86,18 @@ define i32 @test5(i32* %p, i64 %i) { ; CHECK: ret i32 0 } +; P[i] != p[(i*4)|1] +define i32 @test6(i32* %p, i64 %i1) { + %i = shl i64 %i1, 2 + %pi = getelementptr i32* %p, i64 %i + %i.next = or i64 %i, 1 + %pi.next = getelementptr i32* %p, i64 %i.next + %x = load i32* %pi + store i32 42, i32* %pi.next + %y = load i32* %pi + %z = sub i32 %x, %y + ret i32 %z +; CHECK: @test6 +; CHECK: ret i32 0 +} |