[llvm] 708999e - [IndVars] Add test for phi select exit value with large BTC (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 9 05:42:20 PDT 2023
Author: Nikita Popov
Date: 2023-10-09T14:42:09+02:00
New Revision: 708999e5b1e214247fff134019eff9bcd6205436
URL: https://github.com/llvm/llvm-project/commit/708999e5b1e214247fff134019eff9bcd6205436
DIFF: https://github.com/llvm/llvm-project/commit/708999e5b1e214247fff134019eff9bcd6205436.diff
LOG: [IndVars] Add test for phi select exit value with large BTC (NFC)
Added:
Modified:
llvm/test/Transforms/IndVarSimplify/exit_value_tests.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/IndVarSimplify/exit_value_tests.ll b/llvm/test/Transforms/IndVarSimplify/exit_value_tests.ll
index 571e261e3c6a28f..32a02c6aa9e6efe 100644
--- a/llvm/test/Transforms/IndVarSimplify/exit_value_tests.ll
+++ b/llvm/test/Transforms/IndVarSimplify/exit_value_tests.ll
@@ -169,6 +169,34 @@ loopexit:
ret i32 %selector
}
+define i32 @unroll_phi_select_constant_nonzero_large_btc(i32 %arg1, i32 %arg2) {
+; CHECK-LABEL: @unroll_phi_select_constant_nonzero_large_btc(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[SELECTOR:%.*]] = phi i32 [ [[ARG1:%.*]], [[ENTRY]] ], [ [[ARG2:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[I_NEXT]] = add nuw i32 [[I]], 1
+; CHECK-NEXT: [[C:%.*]] = icmp ult i32 [[I]], -42
+; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[LOOPEXIT:%.*]]
+; CHECK: loopexit:
+; CHECK-NEXT: [[SELECTOR_LCSSA:%.*]] = phi i32 [ [[SELECTOR]], [[LOOP]] ]
+; CHECK-NEXT: ret i32 [[SELECTOR_LCSSA]]
+;
+entry:
+ br label %loop
+
+loop:
+ %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
+ %selector = phi i32 [%arg1, %entry], [%arg2, %loop]
+ %i.next = add nuw i32 %i, 1
+ %c = icmp ult i32 %i, -42
+ br i1 %c, label %loop, label %loopexit
+
+loopexit:
+ ret i32 %selector
+}
+
declare i32 @f()
; After LCSSA formation, there's no LCSSA phi for %f since it isn't directly
More information about the llvm-commits
mailing list