[llvm] [VPlan] Pass the mask's compare predicate when costing a blend. (PR #218422)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 06:46:05 PDT 2026
================
@@ -3334,9 +3334,16 @@ InstructionCost VPBlendRecipe::computeCost(ElementCount VF,
Type *ResultTy = toVectorTy(this->getScalarType(), VF);
Type *CmpTy = toVectorTy(Type::getInt1Ty(Ctx.LLVMCtx), VF);
- return (getNumIncomingValues() - 1) *
- Ctx.TTI.getCmpSelInstrCost(Instruction::Select, ResultTy, CmpTy,
- CmpInst::BAD_ICMP_PREDICATE, Ctx.CostKind);
+
+ InstructionCost Cost = 0;
+ for (unsigned I = 1, E = getNumIncomingValues(); I != E; ++I) {
+ CmpPredicate Pred;
+ if (!match(getMask(I), m_Cmp(Pred, m_VPValue(), m_VPValue())))
+ Pred = CmpInst::BAD_ICMP_PREDICATE;
+ Cost += Ctx.TTI.getCmpSelInstrCost(Instruction::Select, ResultTy, CmpTy,
----------------
fhahn wrote:
I updated it to use `CmpInst::BAD_FCMP_PREDICATE`, but currently it looks like no target really makes use of it
https://github.com/llvm/llvm-project/pull/218422
More information about the llvm-commits
mailing list