[llvm] [AMDGPU][DAGCombiner][GlobalISel] Prevent FMA contraction when multiply cannot be eliminated (PR #169735)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 1 09:06:37 PST 2025
================
@@ -15495,6 +15461,36 @@ unsigned SITargetLowering::getFusedOpcode(const SelectionDAG &DAG,
return 0;
}
+// Check if an FADD node should be contracted into a fused operation.
+// Returns true if the FADD has only one use, or if all uses are contractable
+// FADD/FSUB operations that would allow the FADD to be eliminated.
+static bool shouldContractFAdd(SDValue FAdd, SelectionDAG &DAG) {
+ if (FAdd->hasOneUse())
+ return true;
+
+ // Check if all uses are contractable fadd or fsub operations
+ const TargetOptions &Options = DAG.getTarget().Options;
+ for (const auto *User : FAdd->users()) {
----------------
arsenm wrote:
Don't do an uncontrolled user scan
https://github.com/llvm/llvm-project/pull/169735
More information about the llvm-commits
mailing list