[PATCH] D62731: Add support for options -frounding-math, -ftrapping-math, -ffp-model=, and -ffp-exception-behavior=, : Specify floating point behavior

Michele Scandale via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 10 16:36:55 PST 2019


michele.scandale added a comment.

In D62731#1775046 <https://reviews.llvm.org/D62731#1775046>, @mibintc wrote:

> In D62731#1773854 <https://reviews.llvm.org/D62731#1773854>, @michele.scandale wrote:
>
> > I've noticed you removed the change for `CompilerInvocation.cpp` about the initialization of the codegen option `NoTrappingMath`. Was that an accident?
>
>
> I checked the old and new version of the patch and it seems like initialization of NoTrappingMath is unchanged, the definition of the option has it default to 0, and CompilerInvocation.cpp sets it like this in ParseLangArgs, was it something else you were looking at?
>
>   Opts.NoTrappingMath = Args.hasArg(OPT_fno_trapping_math);


In the driver code you don't always pass `-fno-trapping-math`, therefore when when the compiler setup the CodeGen options in `ParseCodeGenArgs` you will end up executing `Opts.NoTrappingMath = Args.hasArg(OPT_fno_trapping_math);` hence you will have that `Opt.NoTrappingMath = false`. This is inconsistent with the state of the compiler driver where no-trapping-math is enabled default.

If you want to keep the default of the CC1 different than the default of the compiler driver, that's fine to me, but in that case the compiler driver needs to pass `-fno-trapping-math` to the CC1.
If we want the same new default, then the logic in `ParseCodeGenArgs` must be updated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62731





More information about the cfe-commits mailing list