[llvm] [SLP] Fix isCommutative to check uses of the original instruction instead of the converted instruction. (PR #143094)
Han-Kuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 16 09:18:58 PDT 2025
================
@@ -536,14 +546,17 @@ 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();
}
+/// This is a helper function to check whether \p I is commutative.
----------------
HanKuanChen wrote:
There are already comments explaining the usage. In most cases, users should use the helper function.
https://github.com/llvm/llvm-project/pull/143094
More information about the llvm-commits
mailing list