[llvm] [SelectionDAG] Remove UnsafeFPMath check in `visitFADDForFMACombine` (PR #127770)
James Y Knight via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 1 11:06:54 PDT 2025
================
@@ -17855,11 +17856,17 @@ template <class MatchContextClass> SDValue DAGCombiner::visitFMA(SDNode *N) {
}
// FIXME: use fast math flags instead of Options.UnsafeFPMath
- if (Options.UnsafeFPMath) {
- if (N0CFP && N0CFP->isZero())
- return N2;
- if (N1CFP && N1CFP->isZero())
- return N2;
+ // TODO: Finally migrate away from global TargetOptions.
+ if (Options.AllowFPOpFusion == FPOpFusion::Fast ||
----------------
jyknight wrote:
I believe the "Options.AllowFPOpFusion == FPOpFusion::Fast" part of the condition is incorrect: -fp-contract=fast means you can translate mul/add to fma globally. It does _not_ mean you can ignore NaNs. Furthermore, no tests fail if I remove this part of the OR.
https://github.com/llvm/llvm-project/pull/127770
More information about the llvm-commits
mailing list