[llvm] [RISCV][VPlan] Cost vp.merges that are likely to be folded away as free (PR #209387)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 15 19:06:47 PDT 2026
================
@@ -2319,11 +2319,19 @@ InstructionCost VPWidenIntrinsicRecipe::computeCallCost(
return toVectorTy(Op->getScalarType(), VF);
});
+ VectorInstrContext VIC = VectorInstrContext::None;
+ for (const VPValue *Op : Operands)
+ if (isa<VPWidenRecipe>(Op) &&
+ Instruction::isBinaryOp(cast<VPWidenRecipe>(Op)->getOpcode())) {
+ VIC = VectorInstrContext::BinaryOp;
+ break;
+ }
+
// TODO: Rework TTI interface to avoid reliance on underlying IntrinsicInst.
IntrinsicCostAttributes CostAttrs(
ID, RetTy, Arguments, ParamTys, R.getFastMathFlagsOrNone(),
----------------
lukel97 wrote:
Yeah. As we do more and more transformations in VPlan we end up with more recipes that don't exist in the original LLVM IR, and only exist at the VPlan level.
It's also a slightly misleading API because we're querying the cost for a vector type, but we pass in scalar values. We can't pass in values of the actual vector type because they're not materialised yet.
https://github.com/llvm/llvm-project/pull/209387
More information about the llvm-commits
mailing list