[llvm] [SelectionDAG] Remove `UnsafeFPMath` in `visitFP_ROUND` (PR #154768)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 21 13:31:49 PDT 2025


================
@@ -18988,7 +18988,7 @@ SDValue DAGCombiner::visitFP_ROUND(SDNode *N) {
     // single-step fp_round we want to fold to.
     // In other words, double rounding isn't the same as rounding.
     // Also, this is a value preserving truncation iff both fp_round's are.
-    if (DAG.getTarget().Options.UnsafeFPMath || N0IsTrunc)
+    if (N->getFlags().hasAllowContract() || N0IsTrunc)
----------------
jcranmer-intel wrote:

To follow the rules for fast-math flags, we have to check the contract flags on all three of nodes in play.

https://github.com/llvm/llvm-project/pull/154768


More information about the llvm-commits mailing list