[llvm-branch-commits] [llvm] [LV] isScalarWithPredication to check for interleaved accesses (PR #194579)
Gaƫtan Bossu via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue May 5 02:24:30 PDT 2026
================
@@ -2465,18 +2465,18 @@ bool LoopVectorizationCostModel::isScalarWithPredication(Instruction *I,
return getCallWideningDecision(cast<CallInst>(I), VF).Kind == CM_Scalarize;
case Instruction::Load:
case Instruction::Store: {
+ // We can use a masked ld/st for consecutive accesses or those that have
+ // been decided to use interleaving.
+ LoopVectorizationCostModel::InstWidening WidenKind =
+ getWideningDecision(I, VF);
auto *Ptr = getLoadStorePointerOperand(I);
auto *Ty = getLoadStoreType(I);
- unsigned AS = getLoadStoreAddressSpace(I);
- Type *VTy = Ty;
- if (VF.isVector())
- VTy = VectorType::get(Ty, VF);
- const Align Alignment = getLoadStoreAlignment(I);
- return isa<LoadInst>(I)
- ? !(Config.isLegalMaskedLoad(Ty, Ptr, Alignment, AS) ||
- TTI.isLegalMaskedGather(VTy, Alignment))
- : !(Config.isLegalMaskedStore(Ty, Ptr, Alignment, AS) ||
- TTI.isLegalMaskedScatter(VTy, Alignment));
+ bool CanUseLdSt =
+ Legal->isConsecutivePtr(Ty, Ptr) || WidenKind == CM_Interleave;
----------------
gbossu wrote:
I've changed `isScalarWithPredication` so that it just trusts the widening decision, without trying to guess it. In the end, there is no need to check interleaving in this function.
https://github.com/llvm/llvm-project/pull/194579
More information about the llvm-branch-commits
mailing list