[llvm] [SCEV] Remove ControlsOnlyExit only used for unsimplified IR. (PR #195052)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 1 06:33:57 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
@llvm/pr-subscribers-llvm-analysis
Author: Florian Hahn (fhahn)
<details>
<summary>Changes</summary>
ControlsOnlyExit is only set to true for And/Or with a neutral element, i.e. unsimplified IR. Remove the complexity, relying on IR simplifications instead.
---
Full diff: https://github.com/llvm/llvm-project/pull/195052.diff
9 Files Affected:
- (modified) llvm/include/llvm/Analysis/ScalarEvolution.h (+4-3)
- (modified) llvm/lib/Analysis/ScalarEvolution.cpp (+6-12)
- (modified) llvm/test/Analysis/ScalarEvolution/trip-count-andor-selectform.ll (+16-24)
- (modified) llvm/test/Analysis/ScalarEvolution/trip-count-andor.ll (+16-24)
- (modified) llvm/test/Transforms/LoopPredication/predicate-exits.ll (+2-5)
- (modified) llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold-negative-testcase.ll (+1-1)
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/pointer-induction.ll (+2-4)
- (modified) llvm/test/Transforms/LoopVectorize/first-order-recurrence-dead-instructions.ll (+1-1)
- (modified) llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll (+1-1)
``````````diff
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 5c01da0855f66..35264ffc439bb 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -2104,9 +2104,10 @@ class ScalarEvolution {
Value *ExitCond, bool ExitIfTrue,
bool ControlsOnlyExit,
bool AllowPredicates);
- std::optional<ScalarEvolution::ExitLimit> computeExitLimitFromCondFromBinOp(
- ExitLimitCacheTy &Cache, const Loop *L, Value *ExitCond, bool ExitIfTrue,
- bool ControlsOnlyExit, bool AllowPredicates);
+ std::optional<ScalarEvolution::ExitLimit>
+ computeExitLimitFromCondFromBinOp(ExitLimitCacheTy &Cache, const Loop *L,
+ Value *ExitCond, bool ExitIfTrue,
+ bool AllowPredicates);
/// Compute the number of times the backedge of the specified loop will
/// execute if its exit condition were a conditional branch of the ICmpInst
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 676292ebe0346..03937e3ef631a 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -9298,7 +9298,7 @@ ScalarEvolution::ExitLimit ScalarEvolution::computeExitLimitFromCondImpl(
bool ControlsOnlyExit, bool AllowPredicates) {
// Handle BinOp conditions (And, Or).
if (auto LimitFromBinOp = computeExitLimitFromCondFromBinOp(
- Cache, L, ExitCond, ExitIfTrue, ControlsOnlyExit, AllowPredicates))
+ Cache, L, ExitCond, ExitIfTrue, AllowPredicates))
return *LimitFromBinOp;
// With an icmp, it may be feasible to compute an exact backedge-taken count.
@@ -9356,9 +9356,11 @@ ScalarEvolution::ExitLimit ScalarEvolution::computeExitLimitFromCondImpl(
}
std::optional<ScalarEvolution::ExitLimit>
-ScalarEvolution::computeExitLimitFromCondFromBinOp(
- ExitLimitCacheTy &Cache, const Loop *L, Value *ExitCond, bool ExitIfTrue,
- bool ControlsOnlyExit, bool AllowPredicates) {
+ScalarEvolution::computeExitLimitFromCondFromBinOp(ExitLimitCacheTy &Cache,
+ const Loop *L,
+ Value *ExitCond,
+ bool ExitIfTrue,
+ bool AllowPredicates) {
// Check if the controlling expression for this loop is an And or Or.
Value *Op0, *Op1;
bool IsAnd;
@@ -9369,14 +9371,6 @@ ScalarEvolution::computeExitLimitFromCondFromBinOp(
else
return std::nullopt;
- // Be robust against unsimplified IR for the form "op i1 X, NeutralElement".
- const Constant *NeutralElement = ConstantInt::get(ExitCond->getType(), IsAnd);
- if (Op0 == NeutralElement)
- std::swap(Op0, Op1);
- if (Op1 == NeutralElement)
- return computeExitLimitFromCondCached(Cache, L, Op0, ExitIfTrue,
- ControlsOnlyExit, AllowPredicates);
-
// A sub-condition of a non-trivial binop never solely controls the exit,
// whether we exit always depends on both conditions.
ExitLimit EL0 = computeExitLimitFromCondCached(
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count-andor-selectform.ll b/llvm/test/Analysis/ScalarEvolution/trip-count-andor-selectform.ll
index 7e052d65d1c8e..26f00ea5ca36a 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count-andor-selectform.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count-andor-selectform.ll
@@ -7,10 +7,9 @@ target triple = "x86_64-unknown-linux-gnu"
define void @unsimplified_and1(i32 %n) {
; CHECK-LABEL: 'unsimplified_and1'
; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and1
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
;
entry:
br label %loop
@@ -29,10 +28,9 @@ leave:
define void @unsimplified_and2(i32 %n) {
; CHECK-LABEL: 'unsimplified_and2'
; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and2
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
;
entry:
br label %loop
@@ -137,10 +135,9 @@ leave:
define void @unsimplified_or3(i32 %n) {
; CHECK-LABEL: 'unsimplified_or3'
; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or3
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
-; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
br label %loop
@@ -159,10 +156,9 @@ leave:
define void @unsimplified_or4(i32 %n) {
; CHECK-LABEL: 'unsimplified_or4'
; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or4
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
;
entry:
br label %loop
@@ -181,10 +177,9 @@ leave:
define void @reversed_and1(i32 %n) {
; CHECK-LABEL: 'reversed_and1'
; CHECK-NEXT: Determining loop execution counts for: @reversed_and1
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
-; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
br label %loop
@@ -203,10 +198,9 @@ leave:
define void @reversed_and2(i32 %n) {
; CHECK-LABEL: 'reversed_and2'
; CHECK-NEXT: Determining loop execution counts for: @reversed_and2
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
-; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
br label %loop
@@ -311,10 +305,9 @@ leave:
define void @reversed_or3(i32 %n) {
; CHECK-LABEL: 'reversed_or3'
; CHECK-NEXT: Determining loop execution counts for: @reversed_or3
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
;
entry:
br label %loop
@@ -333,10 +326,9 @@ leave:
define void @reversed_or4(i32 %n) {
; CHECK-LABEL: 'reversed_or4'
; CHECK-NEXT: Determining loop execution counts for: @reversed_or4
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
-; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
br label %loop
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count-andor.ll b/llvm/test/Analysis/ScalarEvolution/trip-count-andor.ll
index 8df88f2d58621..34bf853b6be02 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count-andor.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count-andor.ll
@@ -7,10 +7,9 @@ target triple = "x86_64-unknown-linux-gnu"
define void @unsimplified_and1(i32 %n) {
; CHECK-LABEL: 'unsimplified_and1'
; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and1
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
;
entry:
br label %loop
@@ -29,10 +28,9 @@ leave:
define void @unsimplified_and2(i32 %n) {
; CHECK-LABEL: 'unsimplified_and2'
; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and2
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
;
entry:
br label %loop
@@ -137,10 +135,9 @@ leave:
define void @unsimplified_or3(i32 %n) {
; CHECK-LABEL: 'unsimplified_or3'
; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or3
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
-; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
br label %loop
@@ -159,10 +156,9 @@ leave:
define void @unsimplified_or4(i32 %n) {
; CHECK-LABEL: 'unsimplified_or4'
; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or4
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
-; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
br label %loop
@@ -181,10 +177,9 @@ leave:
define void @reversed_and1(i32 %n) {
; CHECK-LABEL: 'reversed_and1'
; CHECK-NEXT: Determining loop execution counts for: @reversed_and1
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
-; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
br label %loop
@@ -203,10 +198,9 @@ leave:
define void @reversed_and2(i32 %n) {
; CHECK-LABEL: 'reversed_and2'
; CHECK-NEXT: Determining loop execution counts for: @reversed_and2
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
-; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
;
entry:
br label %loop
@@ -311,10 +305,9 @@ leave:
define void @reversed_or3(i32 %n) {
; CHECK-LABEL: 'reversed_or3'
; CHECK-NEXT: Determining loop execution counts for: @reversed_or3
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
;
entry:
br label %loop
@@ -333,10 +326,9 @@ leave:
define void @reversed_or4(i32 %n) {
; CHECK-LABEL: 'reversed_or4'
; CHECK-NEXT: Determining loop execution counts for: @reversed_or4
-; CHECK-NEXT: Loop %loop: backedge-taken count is %n
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -1
; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is %n
-; CHECK-NEXT: Loop %loop: Trip multiple is 1
;
entry:
br label %loop
diff --git a/llvm/test/Transforms/LoopPredication/predicate-exits.ll b/llvm/test/Transforms/LoopPredication/predicate-exits.ll
index 862b917f8a53d..e72a797f9a0f1 100644
--- a/llvm/test/Transforms/LoopPredication/predicate-exits.ll
+++ b/llvm/test/Transforms/LoopPredication/predicate-exits.ll
@@ -986,12 +986,9 @@ define i32 @wb_in_loop(ptr %array, i32 %length, i32 %n, i1 %cond_0) {
; CHECK-NEXT: [[UMAX:%.*]] = call i32 @llvm.umax.i32(i32 [[N:%.*]], i32 1)
; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[UMAX]], -1
; CHECK-NEXT: [[UMIN:%.*]] = call i32 @llvm.umin.i32(i32 [[LENGTH:%.*]], i32 [[TMP0]])
-; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i32 [[LENGTH]], [[UMIN]]
-; CHECK-NEXT: [[TMP2:%.*]] = freeze i1 [[TMP1]]
-; CHECK-NEXT: [[TMP3:%.*]] = and i1 [[TMP2]], [[COND_0:%.*]]
; CHECK-NEXT: [[TMP4:%.*]] = icmp ugt i32 [[LENGTH]], [[UMIN]]
; CHECK-NEXT: [[TMP5:%.*]] = freeze i1 [[TMP4]]
-; CHECK-NEXT: [[TMP6:%.*]] = and i1 [[TMP5]], [[TMP3]]
+; CHECK-NEXT: [[TMP6:%.*]] = and i1 [[TMP5]], [[TMP3:%.*]]
; CHECK-NEXT: [[EXIPLICIT_GUARD_COND:%.*]] = and i1 [[TMP6]], [[WIDENABLE_COND]]
; CHECK-NEXT: br i1 [[EXIPLICIT_GUARD_COND]], label [[LOOP_PREHEADER:%.*]], label [[DEOPT:%.*]], !prof [[PROF0]]
; CHECK: deopt:
@@ -1013,7 +1010,7 @@ define i32 @wb_in_loop(ptr %array, i32 %length, i32 %n, i1 %cond_0) {
; CHECK-NEXT: call void @unknown()
; CHECK-NEXT: [[WITHIN_BOUNDS2:%.*]] = icmp ult i32 [[I]], [[LENGTH]]
; CHECK-NEXT: [[WB_COND:%.*]] = and i1 [[WITHIN_BOUNDS2]], true
-; CHECK-NEXT: br i1 true, label [[GUARDED2]], label [[DEOPT3:%.*]], !prof [[PROF0]]
+; CHECK-NEXT: br i1 [[WB_COND]], label [[GUARDED2]], label [[DEOPT3:%.*]], !prof [[PROF0]]
; CHECK: deopt3:
; CHECK-NEXT: call void @unknown()
; CHECK-NEXT: [[DEOPTRET3:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32() [ "deopt"() ]
diff --git a/llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold-negative-testcase.ll b/llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold-negative-testcase.ll
index 89ddba3343ffa..b16a981afdee0 100644
--- a/llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold-negative-testcase.ll
+++ b/llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold-negative-testcase.ll
@@ -188,7 +188,7 @@ define void @NonIcmp(ptr %a) {
; CHECK-NEXT: [[UGLYGEP2]] = getelementptr i8, ptr [[LSR_IV1]], i64 4
; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp sle i64 [[LSR_IV2]], 0
; CHECK-NEXT: [[FIND_COND:%.*]] = and i1 [[EXITCOND_NOT]], true
-; CHECK-NEXT: [[LSR_IV_NEXT3]] = add nsw i64 [[LSR_IV2]], -1
+; CHECK-NEXT: [[LSR_IV_NEXT3]] = add i64 [[LSR_IV2]], -1
; CHECK-NEXT: br i1 [[FIND_COND]], label [[FOR_END:%.*]], label [[FOR_BODY]]
; CHECK: for.end:
; CHECK-NEXT: ret void
diff --git a/llvm/test/Transforms/LoopVectorize/RISCV/pointer-induction.ll b/llvm/test/Transforms/LoopVectorize/RISCV/pointer-induction.ll
index 786ef735fc7ad..f24cefa295138 100644
--- a/llvm/test/Transforms/LoopVectorize/RISCV/pointer-induction.ll
+++ b/llvm/test/Transforms/LoopVectorize/RISCV/pointer-induction.ll
@@ -128,8 +128,7 @@ define i1 @scalarize_ptr_induction(ptr %start, ptr %end, ptr noalias %dst, i1 %c
; CHECK-NEXT: store i64 [[MUL2]], ptr [[DST]], align 1
; CHECK-NEXT: [[PTR_IV_NEXT]] = getelementptr nusw i8, ptr [[PTR_IV]], i64 12
; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr [[PTR_IV_NEXT]], [[END]]
-; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[CMP]], i1 true, i1 false
-; CHECK-NEXT: br i1 [[OR_COND]], label %[[EXIT]], label %[[LOOP]], !llvm.loop [[LOOP9:![0-9]+]]
+; CHECK-NEXT: br i1 [[CMP]], label %[[EXIT]], label %[[LOOP]], !llvm.loop [[LOOP9:![0-9]+]]
; CHECK: [[EXIT]]:
; CHECK-NEXT: [[CMP_LCSSA:%.*]] = phi i1 [ [[CMP]], %[[LOOP]] ], [ [[TMP25]], %[[MIDDLE_BLOCK]] ]
; CHECK-NEXT: ret i1 [[CMP_LCSSA]]
@@ -148,8 +147,7 @@ loop:
store i64 %mul2, ptr %dst, align 1
%ptr.iv.next = getelementptr nusw i8, ptr %ptr.iv, i64 12
%cmp = icmp eq ptr %ptr.iv.next, %end
- %or.cond = select i1 %cmp, i1 true, i1 false
- br i1 %or.cond, label %exit, label %loop
+ br i1 %cmp, label %exit, label %loop
exit:
ret i1 %cmp
diff --git a/llvm/test/Transforms/LoopVectorize/first-order-recurrence-dead-instructions.ll b/llvm/test/Transforms/LoopVectorize/first-order-recurrence-dead-instructions.ll
index 3b38ba28ae170..db6aa937120c3 100644
--- a/llvm/test/Transforms/LoopVectorize/first-order-recurrence-dead-instructions.ll
+++ b/llvm/test/Transforms/LoopVectorize/first-order-recurrence-dead-instructions.ll
@@ -118,7 +118,7 @@ loop:
%for = phi i32 [ 0, %entry ], [ %for.prev, %loop ]
%cmp = icmp eq i32 %for, 15
%C = icmp eq i1 %cmp, true
- %vec.dead = and i1 %C, 1
+ %vec.dead = and i1 %C, %cmp
%iv.next = add i16 %iv, 1
%B1 = or i16 %iv.next, %iv.next
%B3 = and i1 %cmp, %C
diff --git a/llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll b/llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll
index 4fde816fc1419..c373b97d8b962 100644
--- a/llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll
+++ b/llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll
@@ -3329,7 +3329,7 @@ loop:
%for = phi i32 [ 0, %entry ], [ %for.prev, %loop ]
%cmp = icmp eq i32 %for, 15
%C = icmp eq i1 %cmp, true
- %vec.dead = and i1 %C, 1
+ %vec.dead = and i1 %C, %cmp
%iv.next = add i16 %iv, 1
%B1 = or i16 %iv.next, %iv.next
%B3 = and i1 %cmp, %C
``````````
</details>
https://github.com/llvm/llvm-project/pull/195052
More information about the llvm-commits
mailing list