[llvm-branch-commits] [llvm] [DAGCombiner][GlobalISel] Extend allMulUsesCanBeContracted with FNEG pattern (PR #188115)
Adel Ejjeh via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 10 11:17:34 PDT 2026
================
@@ -17695,6 +17696,16 @@ static bool allMulUsesCanBeContracted(SDValue Mul) {
if (Opcode == ISD::FADD || Opcode == ISD::FSUB)
continue;
+ // FNEG use - contractable if all users of the fneg are FSUB.
+ if (Opcode == ISD::FNEG) {
+ for (const auto *FNegUser : User->users()) {
----------------
adelejjeh wrote:
The goal of this PR chain is to make sure that all users of a multiply are contractible before we contract the multiply into an fma, otherwise we will be duplicating hte work of the multiply. If we don't check all users, we cannot verify that criteria. Either we check all, or we decide that allowing the duplication of the multiply is alright. The goal here was to reduce the energy that would be spent on doing the extra multiplication since mul + add will cost less energy than a mul + fma.
https://github.com/llvm/llvm-project/pull/188115
More information about the llvm-branch-commits
mailing list