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

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 25 11:50:29 PDT 2022


zahiraam 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)
----------------
michele.scandale wrote:
> 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?
This is to make sure that if we are using -ffast-math or -funsafe-math-optimization along with -ffp-contract=off, fma instructions are not generated.  In this case the function shouldn't be marked with the unsafe-fp-math attribute.


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