[PATCH] D123630: Remove connection between 'ffast-math' and 'ffp-contract'.

Joshua Cranmer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 8 11:16:49 PDT 2022


jcranmer-intel added a comment.

Some general comments on the documentation here:

One of the lesser-known issues of `-ffast-math` is the fact that it (or `-funsafe-math-optimizations`) causes `crtfastmath.o` to be linked, which adds a static constructor that sets the FTZ/DAZ bits in MXCSR, affecting not only the current compilation unit but all static and shared libraries included in the program. This behavior deserves to be mentioned somewhere in the documentation. Additionally, the effects of fast-math/unsafe-math-optimizations on fdenormal-fp-math{32} should be noted. I realize this is orthogonal to the actual change you're doing here, but while we're improving the documentation of `-f[no-]fast-math`, we should probably fix this missing documentation at the same time.



================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2778
+  StringRef LastSeenFfpContractOption;
+  StringRef LastSeenFfastMathOption;
   if (!JA.isDeviceOffloading(Action::OFK_Cuda) &&
----------------
Given that this will only be set to "" or "fast", it probably makes sense to make for this be a `bool SeenFfastMathOption` variable instead.


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

https://reviews.llvm.org/D123630



More information about the cfe-commits mailing list