[llvm] [LV] Add initial support for vectorizing literal struct return values (PR #109833)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 09:05:47 PST 2025


================
@@ -1442,6 +1451,9 @@ InstructionCost VPWidenRecipe::computeCost(ElementCount VF,
     Type *VectorTy = toVectorTy(Ctx.Types.inferScalarType(this), VF);
     return Ctx.TTI.getArithmeticInstrCost(Instruction::Mul, VectorTy, CostKind);
   }
+  case Instruction::ExtractValue:
+    return Ctx.TTI.getInstructionCost(cast<Instruction>(getUnderlyingValue()),
----------------
MacDue wrote:

This was just following what ``LoopVectorizationCostModel::getInstructionCost(Instruction *I, ElementCount VF)`` does (which is called by `getLegacyCost()`), which appears to ignore the VF for `extractvalue`. 

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


More information about the llvm-commits mailing list