From 5d1704ddbf6d6471f4e8f9e0b27ab844d80e8172 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 27 Sep 2009 19:57:57 +0000 Subject: implement PR4895, by making FoldOpIntoPhi handle select conditions that are phi nodes. Also tighten up FoldOpIntoPhi to treat constantexpr operands to phis just like other variables, avoiding moving constantexpr computations around. Patch by Daniel Dunbar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82913 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/select.ll | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/Transforms/InstCombine/select.ll') diff --git a/test/Transforms/InstCombine/select.ll b/test/Transforms/InstCombine/select.ll index 22fe57f237..fc4b82002d 100644 --- a/test/Transforms/InstCombine/select.ll +++ b/test/Transforms/InstCombine/select.ll @@ -202,3 +202,25 @@ define i1 @test24(i1 %a, i1 %b) { ret i1 %c } +define i32 @test25() { +entry: + br i1 false, label %jump, label %ret +jump: + br label %ret +ret: + %a = phi i1 [true, %jump], [false, %entry] + %b = select i1 %a, i32 10, i32 20 + ret i32 %b +} + +define i32 @test26() { +entry: + br i1 false, label %jump, label %ret +jump: + %c = or i1 false, false + br label %ret +ret: + %a = phi i1 [true, %jump], [%c, %entry] + %b = select i1 %a, i32 10, i32 20 + ret i32 %b +} -- cgit v1.2.3