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

Sanjay Patel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 20 05:49:29 PST 2020


spatel added a comment.

In D72675#1827893 <https://reviews.llvm.org/D72675#1827893>, @wristow wrote:

> How to handle this seems like an implementation question.  The code here is just deciding whether or not we intend to pass "-ffast-math" to cc1 (it isn't directly defining `__FAST_MATH__`).  If we do pass it to cc1, then "clang/lib/Frontend/InitPreprocessor.cpp" will pre-define `__FAST_MATH__`:
>
>   if (LangOpts.FastMath)
>     Builder.defineMacro("__FAST_MATH__");
>   
>
> It seems to me that a straightforward way to deal with this question is to make the above test more elaborate (that is, if `LangOpts.FastMath` is set, OR whatever the appropriate subset of fast-math switches are set).  If we do that, we don't need to deal with the "umbrella" aspect of "-ffast-math", which gets messy.
>
> Which is to say the approach here can stay the same as it currently is (`-ffp-contract=off/on` suppressing the passing of "-ffast-math" to cc1).  Although the comment about `__FAST_MATH__` here in "Clang.cpp" should be changed, if we take this approach.


That sounds fine to me, so could update that comment/this patch.

Let's give this a couple of days after updating to see if anyone else has feedback though. I'm never exactly sure what our responsibility is with respect to gcc compatibility.


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

https://reviews.llvm.org/D72675





More information about the cfe-commits mailing list