diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-27 00:34:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-27 00:34:38 +0000 |
commit | e19e4baf3b4f145fad122de7e6a02ed3a68bc082 (patch) | |
tree | 9809e0aee28bbf9b3d16ca3ffb68ef7eea5b988a /test/Transforms/GVN/rle-phi-translate.ll | |
parent | c514c1f5218b8fe7499a0b9a4737860344cf4c43 (diff) | |
download | external_llvm-e19e4baf3b4f145fad122de7e6a02ed3a68bc082.zip external_llvm-e19e4baf3b4f145fad122de7e6a02ed3a68bc082.tar.gz external_llvm-e19e4baf3b4f145fad122de7e6a02ed3a68bc082.tar.bz2 |
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
Diffstat (limited to 'test/Transforms/GVN/rle-phi-translate.ll')
-rw-r--r-- | test/Transforms/GVN/rle-phi-translate.ll | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/Transforms/GVN/rle-phi-translate.ll b/test/Transforms/GVN/rle-phi-translate.ll index ac9e7aa..912f580 100644 --- a/test/Transforms/GVN/rle-phi-translate.ll +++ b/test/Transforms/GVN/rle-phi-translate.ll @@ -86,3 +86,29 @@ bb2: ret i32 %dv } +; PR5313 +define i32 @test4(i1 %cond, i32* %b, i32* %c) nounwind { +; CHECK: @test4 +entry: + br i1 %cond, label %bb, label %bb1 + +bb: + store i32 4, i32* %b + br label %bb2 + +bb1: + %c1 = getelementptr i32* %c, i32 7 + store i32 82, i32* %c1 + br label %bb2 + +bb2: + %d = phi i32* [ %c, %bb1 ], [ %b, %bb ] + %i = phi i32 [ 7, %bb1 ], [ 0, %bb ] + %d1 = getelementptr i32* %d, i32 %i + %dv = load i32* %d1 +; CHECK: %dv = phi i32 [ 82, %bb1 ], [ 4, %bb ] +; CHECK-NOT: load +; CHECK: ret i32 %dv + ret i32 %dv +} + |