[llvm] [LV] Vectorize conditional scalar assignments (PR #158088)
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 26 01:16:45 PST 2025
================
@@ -712,6 +726,17 @@ RecurrenceDescriptor::isFindIVPattern(RecurKind Kind, Loop *TheLoop,
m_Value(NonRdxPhi)))))
return InstDesc(false, I);
+ if (isFindLastRecurrenceKind(Kind)) {
+ // Must be an integer scalar.
+ Type *Type = OrigPhi->getType();
+ if (!Type->isIntegerTy())
+ return InstDesc(false, I);
----------------
Mel-Chen wrote:
We can remove the type checking. `AddReductionVar` has already performed this check:
```
Type *ScalarTy = RecurrenceType->getScalarType();
if (ScalarTy->isFloatingPointTy()) {
if (!isFloatingPointRecurrenceKind(Kind))
return false;
} else if (ScalarTy->isIntegerTy()) {
if (!isIntegerRecurrenceKind(Kind))
return false;
if (!isMinMaxRecurrenceKind(Kind))
Start = lookThroughAnd(Phi, RecurrenceType, VisitedInsts, CastInsts);
} else {
// Pointer min/max may exist, but it is not supported as a reduction op.
return false;
}
```
https://github.com/llvm/llvm-project/pull/158088
More information about the llvm-commits
mailing list