[llvm] [VPlan][NFC] Add cost for `VPWidenMemoryRecipe`. (PR #105614)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 01:23:08 PDT 2024


================
@@ -2079,6 +2079,44 @@ void VPPredInstPHIRecipe::print(raw_ostream &O, const Twine &Indent,
 }
 #endif
 
+InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
+                                                 VPCostContext &Ctx) const {
+  Type *Ty = ToVectorTy(getLoadStoreType(&Ingredient), VF);
+  const Align Alignment =
+      getLoadStoreAlignment(const_cast<Instruction *>(&Ingredient));
+  unsigned AS =
+      getLoadStoreAddressSpace(const_cast<Instruction *>(&Ingredient));
+  TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
+
+  if (!Consecutive) {
+    // TODO: Using the original IR may not be accurate.
+    // Currently, ARM will use the underlying IR to calculate gather/scatter
+    // instruction cost.
+    const Value *Ptr = getLoadStorePointerOperand(&Ingredient);
----------------
fhahn wrote:

nit: can we assert !Reverse here?

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


More information about the llvm-commits mailing list