diff options
author | Chris Lattner <sabre@nondot.org> | 2009-09-27 20:18:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-09-27 20:18:49 +0000 |
commit | c6df8f4d5f8c1d672847ccc91eade453b21a4884 (patch) | |
tree | 0c9ca7659d7ef71bc35512c98d6d8f3f0594b89b /test/Transforms | |
parent | 5d1704ddbf6d6471f4e8f9e0b27ab844d80e8172 (diff) | |
download | external_llvm-c6df8f4d5f8c1d672847ccc91eade453b21a4884.zip external_llvm-c6df8f4d5f8c1d672847ccc91eade453b21a4884.tar.gz external_llvm-c6df8f4d5f8c1d672847ccc91eade453b21a4884.tar.bz2 |
Enhance the previous fix for PR4895 to allow more values than just
simple constants for the true/false value of the select. We now
do phi translation etc. This really fixes PR4895 :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82917 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/InstCombine/select.ll | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/test/Transforms/InstCombine/select.ll b/test/Transforms/InstCombine/select.ll index fc4b820..701d596 100644 --- a/test/Transforms/InstCombine/select.ll +++ b/test/Transforms/InstCombine/select.ll @@ -202,9 +202,9 @@ define i1 @test24(i1 %a, i1 %b) { ret i1 %c } -define i32 @test25() { +define i32 @test25(i1 %c) { entry: - br i1 false, label %jump, label %ret + br i1 %c, label %jump, label %ret jump: br label %ret ret: @@ -213,9 +213,9 @@ ret: ret i32 %b } -define i32 @test26() { +define i32 @test26(i1 %cond) { entry: - br i1 false, label %jump, label %ret + br i1 %cond, label %jump, label %ret jump: %c = or i1 false, false br label %ret @@ -224,3 +224,26 @@ ret: %b = select i1 %a, i32 10, i32 20 ret i32 %b } + +define i32 @test27(i1 %c, i32 %A, i32 %B) { +entry: + br i1 %c, label %jump, label %ret +jump: + br label %ret +ret: + %a = phi i1 [true, %jump], [false, %entry] + %b = select i1 %a, i32 %A, i32 %B + ret i32 %b +} + +define i32 @test28(i1 %cond, i32 %A, i32 %B) { +entry: + br i1 %cond, label %jump, label %ret +jump: + br label %ret +ret: + %c = phi i32 [%A, %jump], [%B, %entry] + %a = phi i1 [true, %jump], [false, %entry] + %b = select i1 %a, i32 %A, i32 %c + ret i32 %b +} |