[PATCH] D80315: Fix CC1 command line options mapping into fast-math flags.

Michele Scandale via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 28 20:19:32 PDT 2020


michele.scandale added a comment.

In D80315#2061164 <https://reviews.llvm.org/D80315#2061164>, @rjmccall wrote:

> In D80315#2059160 <https://reviews.llvm.org/D80315#2059160>, @michele.scandale wrote:
>
> > In D80315#2058914 <https://reviews.llvm.org/D80315#2058914>, @rjmccall wrote:
> >
> > > In D80315#2058735 <https://reviews.llvm.org/D80315#2058735>, @michele.scandale wrote:
> > >
> > > > In D80315#2058549 <https://reviews.llvm.org/D80315#2058549>, @rjmccall wrote:
> > > >
> > > > > The code cleanups all seems reasonable.  The actual changes in code-generation changes are because we were failing to set these reliably?
> > > >
> > > >
> > > > Most of them yes.
> > > >
> > > > In the CUDA test we there is now `contract` because we honor the default contraction mode that for CUDA is set to fast.
> > >
> > >
> > > Right, and we weren't honoring that mode before?
> >
> >
> > Not in the setup of base fast-math flags inside `CodeGenFunction`. However when emitting code for expression with `FPOptions` stored in the AST nodes then `contract` was set correctly.
>
>
> Okay, that seems justifiable.
>
> >>> In `clang/test/CodeGen/complex-math.c` I've added `-ffp-contract=fast` to the command line option because `-ffast-math` at the CC1 level does not change the default contraction mode.
> >> 
> >> Oh, I see, makes sense.  So there was inconsistent treatment of the options, where one thing observed it but others didn't, and that's been fixed now.
> > 
> > Do you think we should handle `-ffast-math` as `-cl-fast-relaxed-math`, i.e. it implies the default contraction mode being "fast"?
>
> I'm actually surprised it doesn't.  I can't imagine why someone enabling fast math would want contraction to be disabled.


Just to be clear the clang driver does the right thing.
If you run `clang -ffast-math` the CC1 invocation has both `-ffast-math` and `-ffp-contract=fast` (and other options as well)

Here specifically I'm just considering the behavior of `clang -cc1 -ffast-math`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80315





More information about the cfe-commits mailing list