[llvm] [LV] isScalarWithPredication to check for interleaved accesses (PR #194579)
Gaƫtan Bossu via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 30 02:24:44 PDT 2026
================
@@ -2465,8 +2465,13 @@ bool LoopVectorizationCostModel::isScalarWithPredication(Instruction *I,
return getCallWideningDecision(cast<CallInst>(I), VF).Kind == CM_Scalarize;
case Instruction::Load:
case Instruction::Store: {
- return !Config.isLegalMaskedLoadOrStore(I, VF) &&
- !Config.isLegalGatherOrScatter(I, VF);
+ LoopVectorizationCostModel::InstWidening WidenKind =
+ getWideningDecision(I, VF);
+ assert(WidenKind != CM_Unknown);
+ // According to the legacy cost model, a masked access is never considered
+ // profitable for scalarization when gather/scatter is available, even if
+ // the chosen widening is CM_Scalarize.
+ return WidenKind == CM_Scalarize && !Config.isLegalGatherOrScatter(I, VF);
----------------
gbossu wrote:
Ultimately, I think this should just be `return WidenKind == CM_Scalarize;`, but I'd like this patch to focus on fixing inconsistencies, not changing the legacy cost model.
https://github.com/llvm/llvm-project/pull/194579
More information about the llvm-commits
mailing list