diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-27 06:42:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-27 06:42:42 +0000 |
commit | d280d85791c1fad9e625a5e2f472092b0c81c14e (patch) | |
tree | f02a2ccf6fa4c5e5ecf334f1e798a62ac741ce6d /test/Transforms/GVN | |
parent | 852dfbdf021dd8313b6b19c88590cf34672e831a (diff) |
add some tests for memdep phi translation + PRE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89996 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/GVN')
-rw-r--r-- | test/Transforms/GVN/pre-load.ll | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/test/Transforms/GVN/pre-load.ll b/test/Transforms/GVN/pre-load.ll index de90465567..637a6d26c8 100644 --- a/test/Transforms/GVN/pre-load.ll +++ b/test/Transforms/GVN/pre-load.ll @@ -11,8 +11,7 @@ block2: ; CHECK-NEXT: load i32* %p block3: - %b = bitcast i32 0 to i32 - store i32 %b, i32* %p + store i32 0, i32* %p br label %block4 block4: @@ -22,3 +21,55 @@ block4: ; CHECK-NEXT: phi i32 ; CHECK-NEXT: ret i32 } + +define i32 @test2(i32* %p, i32* %q, i1 %C) { +; CHECK: @test2 +block1: + br i1 %C, label %block2, label %block3 + +block2: + br label %block4 +; CHECK: block2: +; CHECK-NEXT: load i32* %q + +block3: + store i32 0, i32* %p + br label %block4 + +block4: + %P2 = phi i32* [%p, %block3], [%q, %block2] + %PRE = load i32* %P2 + ret i32 %PRE +; CHECK: block4: +; CHECK-NEXT: phi i32 [ +; CHECK-NOT: load +; CHECK: ret i32 +} + +define i32 @test3(i32* %p, i32* %q, i32** %Hack, i1 %C) { +; CHECK: @test3 +block1: + %B = getelementptr i32* %q, i32 1 + store i32* %B, i32** %Hack + br i1 %C, label %block2, label %block3 + +block2: + br label %block4 +; CHECK: block2: +; CHECK-NEXT: load i32* %B + +block3: + %A = getelementptr i32* %p, i32 1 + store i32 0, i32* %A + br label %block4 + +block4: + %P2 = phi i32* [%p, %block3], [%q, %block2] + %P3 = getelementptr i32* %P2, i32 1 + %PRE = load i32* %P3 + ret i32 %PRE +; CHECK: block4: +; CHECK-NEXT: phi i32 [ +; CHECK-NOT: load +; CHECK: ret i32 +} |