[llvm] [VPlan] Impl VPlan-based pattern match for ExtendedRed and MulAccRed (PR #113903)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 27 13:12:47 PDT 2025
================
@@ -782,19 +784,25 @@ Value *VPInstruction::generate(VPTransformState &State) {
InstructionCost VPInstruction::computeCost(ElementCount VF,
VPCostContext &Ctx) const {
if (Instruction::isBinaryOp(getOpcode())) {
+
+ Type *ResTy = Ctx.Types.inferScalarType(this);
+ if (!vputils::onlyFirstLaneUsed(this))
+ ResTy = toVectorTy(ResTy, VF);
+
if (!getUnderlyingValue()) {
- // TODO: Compute cost for VPInstructions without underlying values once
- // the legacy cost model has been retired.
- return 0;
+ switch (getOpcode()) {
+ case Instruction::FMul:
+ return Ctx.TTI.getArithmeticInstrCost(getOpcode(), ResTy, Ctx.CostKind);
+ default:
+ // TODO: Compute cost for VPInstructions without underlying values once
+ // the legacy cost model has been retired.
+ return 0;
+ }
----------------
fhahn wrote:
I see, is it possible we are missing tests for that? Removing the code seems to not cause any test failures.
Could you add tests showing the difference?
https://github.com/llvm/llvm-project/pull/113903
More information about the llvm-commits
mailing list