[llvm] [SLP] Fix isCommutative to check uses of the original instruction instead of the converted instruction. (PR #143094)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 7 03:29:32 PDT 2025
================
@@ -536,14 +542,16 @@ static bool isCommutative(Instruction *I) {
Flag->isOne());
})) ||
(BO->getOpcode() == Instruction::FSub &&
- !BO->hasNUsesOrMore(UsesLimit) &&
- all_of(BO->uses(), [](const Use &U) {
+ !InstWithUses->hasNUsesOrMore(UsesLimit) &&
+ all_of(InstWithUses->uses(), [](const Use &U) {
return match(U.getUser(),
m_Intrinsic<Intrinsic::fabs>(m_Specific(U.get())));
}));
return I->isCommutative();
}
+static bool isCommutative(Instruction *I) { return isCommutative(I, I); }
----------------
alexey-bataev wrote:
1. Add a comment for this function too
2. Do we need it at all?
https://github.com/llvm/llvm-project/pull/143094
More information about the llvm-commits
mailing list