aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kazantsev <mkazantsev@azul.com>2021-03-19 14:25:08 +0700
committerMax Kazantsev <mkazantsev@azul.com>2021-03-19 14:26:03 +0700
commita1d6c652e3a0fba31377474af2436c9a9ceac6cc (patch)
tree25e76b9aaf115dc3ba674a197a4d4855c9cc56b3
parenta825fb2c07337cc2c84783558e91416e07adcf42 (diff)
downloadllvm-a1d6c652e3a0fba31377474af2436c9a9ceac6cc.zip
llvm-a1d6c652e3a0fba31377474af2436c9a9ceac6cc.tar.gz
llvm-a1d6c652e3a0fba31377474af2436c9a9ceac6cc.tar.bz2
[Test] Precommit one more test
-rw-r--r--llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll52
1 files changed, 52 insertions, 0 deletions
diff --git a/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll b/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
index c367176..48a51d7 100644
--- a/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
+++ b/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
@@ -1094,4 +1094,56 @@ exit:
ret i32 %iv
}
+define i32 @func_28(i32 %start) {
+; CHECK-LABEL: @func_28(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[START:%.*]], [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
+; CHECK-NEXT: [[C1:%.*]] = icmp ne i32 [[IV]], 0
+; CHECK-NEXT: [[C2:%.*]] = icmp ne i32 [[IV]], 0
+; CHECK-NEXT: [[C3:%.*]] = icmp ne i32 [[IV]], 0
+; CHECK-NEXT: br i1 [[C1]], label [[CHECKED_1:%.*]], label [[FAIL:%.*]]
+; CHECK: checked.1:
+; CHECK-NEXT: br i1 [[C2]], label [[CHECKED_2:%.*]], label [[FAIL]]
+; CHECK: checked.2:
+; CHECK-NEXT: br i1 [[C3]], label [[BACKEDGE]], label [[FAIL]]
+; CHECK: backedge:
+; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 758394
+; CHECK-NEXT: [[LOOP_COND:%.*]] = call i1 @cond_func()
+; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
+; CHECK: fail:
+; CHECK-NEXT: unreachable
+; CHECK: exit:
+; CHECK-NEXT: [[IV_LCSSA1:%.*]] = phi i32 [ [[IV]], [[BACKEDGE]] ]
+; CHECK-NEXT: ret i32 [[IV_LCSSA1]]
+;
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i32 [%start, %entry], [%iv.next, %backedge]
+ %c1 = icmp ne i32 %iv, 0
+ %c2 = icmp ne i32 %iv, 0
+ %c3 = icmp ne i32 %iv, 0
+ br i1 %c1, label %checked.1, label %fail
+
+checked.1:
+ br i1 %c2, label %checked.2, label %fail
+
+checked.2:
+ br i1 %c3, label %backedge, label %fail
+
+backedge:
+ %iv.next = add i32 %iv, 758394
+ %loop.cond = call i1 @cond_func()
+ br i1 %loop.cond, label %loop, label %exit
+
+fail:
+ unreachable
+
+exit:
+ ret i32 %iv
+}
+
!0 = !{i32 0, i32 2147483647}