[llvm-branch-commits] [llvm] Prevent optimizations of math intrinsics in strictfp functions (PR #201433)

Serge Pavlov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jun 8 11:02:07 PDT 2026


================
@@ -6093,8 +6093,11 @@ static Value *simplifyFMAFMul(Value *Op0, Value *Op1, FastMathFlags FMF,
   // 3. Ignore -0.0 because sqrt(-0.0) == -0.0, but -0.0 * -0.0 == 0.0.
   Value *X;
   if (Op0 == Op1 && match(Op0, m_Sqrt(m_Value(X))) && FMF.allowReassoc() &&
-      FMF.noNaNs() && FMF.noSignedZeros())
+      FMF.noNaNs() && FMF.noSignedZeros()) {
+    if (Q.isStrictFP())
----------------
spavloff wrote:

This is definitely a good idea. Maybe I will make a separate PR for such a helper class, it depends on how numerous changes will be.

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


More information about the llvm-branch-commits mailing list