aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine/select.ll
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-11-10 18:23:01 +0000
committerDuncan Sands <baldrick@free.fr>2010-11-10 18:23:01 +0000
commita74a58c83be492b7d5b7383656f049909394cff4 (patch)
treeab6a3c9367543fa15c84383d47e295341559537f /test/Transforms/InstCombine/select.ll
parentb395e4a0262c36b17b18aa33514b2daf2a85e9a3 (diff)
downloadexternal_llvm-a74a58c83be492b7d5b7383656f049909394cff4.zip
external_llvm-a74a58c83be492b7d5b7383656f049909394cff4.tar.gz
external_llvm-a74a58c83be492b7d5b7383656f049909394cff4.tar.bz2
Teach InstructionSimplify how to look through PHI nodes. Since PHI
nodes can be used in loops, this could result in infinite looping if there is no recursion limit, so add such a limit. It is also used for the SelectInst case because in theory there could be an infinite loop there too if the basic block is unreachable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118694 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/select.ll')
-rw-r--r--test/Transforms/InstCombine/select.ll47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/select.ll b/test/Transforms/InstCombine/select.ll
index c49c713..62f0eda 100644
--- a/test/Transforms/InstCombine/select.ll
+++ b/test/Transforms/InstCombine/select.ll
@@ -499,3 +499,50 @@ define i1 @test40(i1 %cond) {
; CHECK: @test40
; CHECK: ret i1 false
}
+
+define i1 @test41(i1 %cond) {
+ %zero = alloca i32
+ %one = alloca i32
+ br i1 %cond, label %true, label %false
+true:
+ br label %ret
+false:
+ br label %ret
+ret:
+ %ptr = phi i32* [ %zero, %true ] , [ %one, %false ]
+ %isnull = icmp eq i32* %ptr, null
+ ret i1 %isnull
+; CHECK: @test41
+; CHECK: ret i1 false
+}
+
+define i1 @test42(i1 %cond, double %x) {
+ br i1 %cond, label %true, label %false
+true:
+ br label %ret
+false:
+ br label %ret
+ret:
+ %p = phi double [ %x, %true ], [ 0x7FF0000000000000, %false ]; RHS = +infty
+ %cmp = fcmp ule double %x, %p
+ ret i1 %cmp
+; CHECK: @test42
+; CHECK: ret i1 true
+}
+
+define i1 @test43(i1 %cond) {
+ %a = alloca i32
+ %b = alloca i32
+ %c = alloca i32
+ br i1 %cond, label %true, label %false
+true:
+ br label %ret
+false:
+ br label %ret
+ret:
+ %p = phi i32* [ %a, %true ], [ %b, %false ]
+ %r = icmp eq i32* %p, %c
+ ret i1 %r
+; CHECK: @test43
+; CHECK: ret i1 false
+}