[llvm] [SLP] Fix canConvertToFMA fmul costing (PR #216425)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 17:54:21 PDT 2026
================
@@ -14489,16 +14489,40 @@ static InstructionCost canConvertToFMA(ArrayRef<Value *> VL,
// Compare the costs.
InstructionCost FMulPlusFAddCost = 0;
InstructionCost FMACost = 0;
+ // Price the fmul as not fused with its user. Passing a context instruction
+ // would let targets that model the fusion discount the unfused side of the
+ // comparison as well.
+ auto GetUnfusedFMulCost = [&](Instruction *I) {
+ assert(I->getOpcode() == Instruction::FMul && "Expected an fmul");
+ TTI::OperandValueInfo Op1Info = TTI::getOperandInfo(I->getOperand(0));
+ TTI::OperandValueInfo Op2Info = TTI::getOperandInfo(I->getOperand(1));
+ return TTI.getArithmeticInstrCost(Instruction::FMul, I->getType(), CostKind,
----------------
alexey-bataev wrote:
```suggestion
return TTI.getArithmeticInstrCost(I->getOpcode(), I->getType(), CostKind,
```
https://github.com/llvm/llvm-project/pull/216425
More information about the llvm-commits
mailing list