================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to