[PATCH] D72675: [Clang][Driver] Fix -ffast-math/-ffp-contract interaction

Sanjay Patel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 17 06:01:21 PST 2020


spatel added a comment.

This follows the reasoning that we discussed in the earlier discussion, but after re-reading the gcc comment in particular, I'm wondering whether this is what we really want to do...
If __FAST_MATH__ is purely here for compatibility with gcc, then should we mimic gcc behavior in setting that macro even if we think it's buggy? 
Ie, when we translate these settings to LLVM's FMF, we can still override the -ffast-math flag by checking the -ffp-contract flag (if I'm seeing it correctly, the existing code will pass that alongside -ffast-math when contract is set to on/off).



================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2763
 
+  // If -ffp-contract=off has been specified on the command line, then we must
+  // suppress the emission of -ffast-math and -menable-unsafe-fp-math to cc1.
----------------
This comment doesn't match the code any more. Should be "If -ffp-contract=off/on, then..."


================
Comment at: clang/test/Driver/fast-math.c:184
+// -ffp-contract=off and -ffp-contract=on must disable the fast-math umbrella,
+// and the unsafe-fp-math umbrella (-ffp-conteact=fast leaves them enabled).
+// RUN: %clang -### -ffast-math -ffp-contract=off -c %s 2>&1 \
----------------
typo: conteact


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

https://reviews.llvm.org/D72675





More information about the cfe-commits mailing list