diff options
Diffstat (limited to 'test/Transforms/IndVarSimplify/tripcount_compute.ll')
-rw-r--r-- | test/Transforms/IndVarSimplify/tripcount_compute.ll | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/Transforms/IndVarSimplify/tripcount_compute.ll b/test/Transforms/IndVarSimplify/tripcount_compute.ll index 626a29b..966d152 100644 --- a/test/Transforms/IndVarSimplify/tripcount_compute.ll +++ b/test/Transforms/IndVarSimplify/tripcount_compute.ll @@ -160,3 +160,34 @@ loop9: ; preds = %loop2, %loopexit loopexit9: ; preds = %loop2 ret i32 %l.next } + +; PR18449. Check that the early exit is reduced to never taken. +; +; CHECK-LABEL: @twoexit +; CHECK-LABEL: loop: +; CHECK: phi +; CHECK: br i1 false +; CHECK: br +; CHECK: ret +define void @twoexit() { +"function top level": + br label %loop + +loop: ; preds = %body, %"function top level" + %0 = phi i64 [ 0, %"function top level" ], [ %2, %body ] + %1 = icmp ugt i64 %0, 2 + br i1 %1, label %fail, label %body + +fail: ; preds = %loop + tail call void @bounds_fail() + unreachable + +body: ; preds = %loop + %2 = add i64 %0, 1 + %3 = icmp slt i64 %2, 3 + br i1 %3, label %loop, label %out + +out: ; preds = %body + ret void +} +declare void @bounds_fail() |