[llvm] [SLP] Let the caller tell canConvertToFMA which operand holds the fmul (PR #218754)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 30 07:26:43 PDT 2026
================
@@ -13712,12 +13712,21 @@ bool BoUpSLP::areAllUsersVectorized(
});
}
-static InstructionCost canConvertToFMA(ArrayRef<Value *> VL,
- const InstructionsState &S,
- DominatorTree &DT, const DataLayout &DL,
- TargetTransformInfo &TTI,
- const TargetLibraryInfo &TLI,
- const TTI::TargetCostKind CostKind);
+static InstructionCost
+canConvertToFMA(ArrayRef<Value *> VL, const InstructionsState &S,
+ DominatorTree &DT, const DataLayout &DL,
+ TargetTransformInfo &TTI, const TargetLibraryInfo &TLI,
+ const TTI::TargetCostKind CostKind, unsigned FMulOpIdx = 0);
+
+/// \returns the operand of \p I that is a one-use fmul, 0 if there is none.
+static unsigned getFMulOperandIdx(const Instruction *I) {
+ for (unsigned Idx : seq<unsigned>(0, I->getNumOperands())) {
+ auto *Op = dyn_cast<Instruction>(I->getOperand(Idx));
+ if (Op && Op->getOpcode() == Instruction::FMul && Op->hasOneUse())
+ return Idx;
+ }
+ return 0;
+}
----------------
MrSidims wrote:
Addressed
https://github.com/llvm/llvm-project/pull/218754
More information about the llvm-commits
mailing list