diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-26 23:41:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-26 23:41:07 +0000 |
commit | cc3d0eb483d17154fe00f68726c097546b7c9352 (patch) | |
tree | dcfa7987978c72e5c6153499635abd895923b524 /test/Transforms/GVN/rle-phi-translate.ll | |
parent | 38028653a95ba7dd666ce01918add96d5d13f412 (diff) | |
download | external_llvm-cc3d0eb483d17154fe00f68726c097546b7c9352.zip external_llvm-cc3d0eb483d17154fe00f68726c097546b7c9352.tar.gz external_llvm-cc3d0eb483d17154fe00f68726c097546b7c9352.tar.bz2 |
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
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 06b0af7..89f5ac3 100644 --- a/test/Transforms/GVN/rle-phi-translate.ll +++ b/test/Transforms/GVN/rle-phi-translate.ll @@ -4,6 +4,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 target triple = "i386-apple-darwin7" define i32 @test1(i32* %b, i32* %c) nounwind { +; CHECK: @test1 entry: %g = alloca i32 %t1 = icmp eq i32* %b, null @@ -34,3 +35,28 @@ bb2: ; preds = %bb1, %bb ret i32 %ret } +define i8 @test2(i1 %cond, i32* %b, i32* %c) nounwind { +; CHECK: @test2 +entry: + br i1 %cond, label %bb, label %bb1 + +bb: + %b1 = bitcast i32* %b to i8* + store i8 4, i8* %b1 + br label %bb2 + +bb1: + %c1 = bitcast i32* %c to i8* + store i8 92, i8* %c1 + br label %bb2 + +bb2: + %d = phi i32* [ %c, %bb1 ], [ %b, %bb ] + %d1 = bitcast i32* %d to i8* + %dv = load i8* %d1 +; CHECK: %dv = phi i8 +; CHECK-NOT: load +; CHECK: ret i8 %dv + ret i8 %dv +} + |