[PATCH] D135097: Remove redundant option '-menable-unsafe-fp-math'.

Michele Scandale via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 25 08:46:18 PDT 2022


michele.scandale added inline comments.


================
Comment at: clang/lib/CodeGen/CGCall.cpp:1865-1869
+    if ((LangOpts.FastMath ||
+         !LangOpts.FastMath && LangOpts.AllowFPReassoc && LangOpts.AllowRecip &&
+             !LangOpts.FiniteMathOnly && LangOpts.NoSignedZero &&
+             LangOpts.ApproxFunc) &&
+        LangOpts.getDefaultFPContractMode() != LangOptions::FPModeKind::FPM_Off)
----------------
If I look at the clang driver code, `-funsafe-math-optimizations` is specified on the CC1 command line if
```
!MathErrno && AssociativeMath && ReciprocalMath && !SignedZeros && ApproxFunc && !TrappingMath
```
is true.
This means that it shouldn't matter the value of the floating point contraction, or whether infs/nans are honored or not.

Was there another issue that this specific part of the change addresses?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135097/new/

https://reviews.llvm.org/D135097



More information about the cfe-commits mailing list