[llvm] [LV] Move condition to VPPartialReductionRecipe::execute (PR #166136)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 10 07:31:10 PST 2025
================
@@ -311,18 +311,27 @@ VPPartialReductionRecipe::computeCost(ElementCount VF,
std::optional<unsigned> Opcode;
VPValue *Op = getVecOp();
uint64_t MulConst;
+
+ InstructionCost CondCost = 0;
+ if (isConditional()) {
+ CmpInst::Predicate Pred = CmpInst::BAD_ICMP_PREDICATE;
+ auto *VecTy = Ctx.Types.inferScalarType(Op);
+ auto *CondTy = Ctx.Types.inferScalarType(getCondOp());
+ CondCost = Ctx.TTI.getCmpSelInstrCost(Instruction::Select, VecTy, CondTy,
+ Pred, Ctx.CostKind);
----------------
sdesmalen-arm wrote:
Yes, I've taken a similar approach as was taken here:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp#L1100-L1103
https://github.com/llvm/llvm-project/pull/166136
More information about the llvm-commits
mailing list