[llvm] [VPlan] Add legal checks in VPWidenMemoryRecipe::computeCost(). NFC (PR #110445)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 02:55:12 PDT 2024


================
@@ -2237,6 +2237,11 @@ InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
     const Value *Ptr = getLoadStorePointerOperand(&Ingredient);
     assert(!Reverse &&
            "Inconsecutive memory access should not have the order.");
+    if ((isa<LoadInst>(Ingredient) &&
+         !Ctx.TTI.isLegalMaskedGather(Ty, Alignment)) ||
+        (isa<StoreInst>(Ingredient) &&
+         !Ctx.TTI.isLegalMaskedScatter(Ty, Alignment)))
+      return InstructionCost::getInvalid();
----------------
fhahn wrote:

I see. I think the difference is that while the legacy cost model needs to consider all options for the input, no masked VPWidenMemoryRecipe should be created , if masked mem-ops aren't legal I think

https://github.com/llvm/llvm-project/pull/110445


More information about the llvm-commits mailing list