[llvm] [SLP] Guard FMulAdd conversion to require single-use/non-reordered FMul operands (PR #189692)
Ryan Buchner via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 1 00:46:48 PDT 2026
================
@@ -14351,6 +14351,22 @@ void BoUpSLP::transformNodes() {
if (E.State != TreeEntry::Vectorize ||
!E.getOperations().isAddSubLikeOp())
break;
+ const TreeEntry *LHS = getOperandEntry(&E, 0);
+ const TreeEntry *RHS = getOperandEntry(&E, 1);
+ auto IsOneUseVectorFMulOperand = [](const TreeEntry *TE) {
+ return TE->State == TreeEntry::Vectorize &&
+ TE->ReorderIndices.empty() && TE->ReuseShuffleIndices.empty() &&
+ TE->getOpcode() == Instruction::FMul && !TE->isAltShuffle() &&
+ all_of(TE->Scalars, [&](Value *V) {
+ return (TE->hasCopyableElements() &&
+ TE->isCopyableElement(V)) ||
+ V->hasOneUse();
+ });
+ };
+ if (!IsOneUseVectorFMulOperand(LHS) &&
+ (E.getOpcode() == Instruction::FSub ||
+ !IsOneUseVectorFMulOperand(RHS)))
+ break;
----------------
bababuck wrote:
Should this be moved into `canConvertToFMA` so that this change is also picked up by the costing (the other user of `canConvertToFMA`)?
https://github.com/llvm/llvm-project/pull/189692
More information about the llvm-commits
mailing list