summaryrefslogtreecommitdiff
path: root/test/Transforms/IndVarSimplify
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-11-29 19:07:57 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-11-29 19:07:57 +0000
commit7d4253af167479759fa5a71b7607b40033b96492 (patch)
treeba939f9409dd2b628037a5153dadb39956def787 /test/Transforms/IndVarSimplify
parentb36be80510b9b38a9341623db3a6a9a49f1764fe (diff)
downloadllvm-7d4253af167479759fa5a71b7607b40033b96492.tar.gz
llvm-7d4253af167479759fa5a71b7607b40033b96492.tar.bz2
llvm-7d4253af167479759fa5a71b7607b40033b96492.tar.xz
Follow up to 168711: It's safe to base this analysis on the found compare, just return the value for the right predicate.
Thanks to Andy for catching this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168921 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/IndVarSimplify')
-rw-r--r--test/Transforms/IndVarSimplify/eliminate-comparison.ll49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/Transforms/IndVarSimplify/eliminate-comparison.ll b/test/Transforms/IndVarSimplify/eliminate-comparison.ll
index 923e591440..5dca712646 100644
--- a/test/Transforms/IndVarSimplify/eliminate-comparison.ll
+++ b/test/Transforms/IndVarSimplify/eliminate-comparison.ll
@@ -160,3 +160,52 @@ unrolledend: ; preds = %forcond38
}
declare void @llvm.trap() noreturn nounwind
+
+; In this case the second loop only has a single iteration, fold the header away
+; CHECK: @func_12
+; CHECK: %tmp5 = icmp slt i32 %__key6.0, 10
+; CHECK: br i1 true, label %noassert68, label %unrolledend
+define i32 @func_12() nounwind uwtable {
+entry:
+ br label %forcond
+
+forcond: ; preds = %noassert, %entry
+ %__key6.0 = phi i32 [ 2, %entry ], [ %tmp37, %noassert ]
+ %tmp5 = icmp slt i32 %__key6.0, 10
+ br i1 %tmp5, label %noassert, label %forcond38.preheader
+
+forcond38.preheader: ; preds = %forcond
+ br label %forcond38
+
+noassert: ; preds = %forbody
+ %tmp13 = sdiv i32 -32768, %__key6.0
+ %tmp2936 = shl i32 %tmp13, 24
+ %sext23 = shl i32 %tmp13, 24
+ %tmp32 = icmp eq i32 %tmp2936, %sext23
+ %tmp37 = add i32 %__key6.0, 1
+ br i1 %tmp32, label %forcond, label %assert33
+
+assert33: ; preds = %noassert
+ tail call void @llvm.trap()
+ unreachable
+
+forcond38: ; preds = %noassert68, %forcond38.preheader
+ %__key8.0 = phi i32 [ %tmp81, %noassert68 ], [ 2, %forcond38.preheader ]
+ %tmp46 = icmp slt i32 %__key8.0, 10
+ br i1 %tmp46, label %noassert68, label %unrolledend
+
+noassert68: ; preds = %forbody39
+ %tmp57 = sdiv i32 -32768, %__key8.0
+ %sext34 = shl i32 %tmp57, 16
+ %sext21 = shl i32 %tmp57, 16
+ %tmp76 = icmp ne i32 %sext34, %sext21
+ %tmp81 = add i32 %__key8.0, 1
+ br i1 %tmp76, label %forcond38, label %assert77
+
+assert77: ; preds = %noassert68
+ tail call void @llvm.trap()
+ unreachable
+
+unrolledend: ; preds = %forcond38
+ ret i32 0
+}