Skip to content

Commit 6db1803

Browse files
committed
[VPlan] Treat Div/Rem as not Predicated if divisor is invariant
Fixes #94328
1 parent 0c5319e commit 6db1803

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3863,7 +3863,8 @@ bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I) const {
38633863
case Instruction::URem:
38643864
// TODO: We can use the loop-preheader as context point here and get
38653865
// context sensitive reasoning
3866-
return !isSafeToSpeculativelyExecute(I);
3866+
return !isSafeToSpeculativelyExecute(I) &&
3867+
!Legal->isInvariant(I->getOperand(1));
38673868
case Instruction::Call:
38683869
return Legal->isMaskRequired(I);
38693870
}

0 commit comments

Comments
 (0)