[llvm] [LV] Move condition to VPPartialReductionRecipe::execute (PR #166136)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 11 02:21:02 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,
----------------
fhahn wrote:

I don't think this computes the correct costs; isn't this passing the scalar types here instead of the vector types?

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


More information about the llvm-commits mailing list