[PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

Andy Kaylor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 11 14:13:37 PST 2020


andrew.w.kaylor added inline comments.


================
Comment at: clang/docs/UsersManual.rst:1388
 
-   * ``precise`` Disables optimizations that are not value-safe on floating-point data, although FP contraction (FMA) is enabled (``-ffp-contract=fast``).  This is the default behavior.
    * ``strict`` Enables ``-frounding-math`` and ``-ffp-exception-behavior=strict``, and disables contractions (FMA).  All of the ``-ffast-math`` enablements are disabled.
----------------
lebedev.ri wrote:
> I'm confused. Where in this patch the `This patch establishes the default option for -ffp-model to select "precise".` happens? LHS of diff says it is already default
The comments said that it was the default, but the actual default was something that didn't quite match any of the fp-models -- precise but with fp contraction off.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2548
       DenormalFPMath = DefaultDenormalFPMath;
       FPContract = "";
       StringRef Val = A->getValue();
----------------
I think this always gets changed to fast, on, or off below, but making it empty here looks wrong.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2661
         // the FPContract value has already been set to a string literal
         // and the Val string isn't a pertinent value.
         ;
----------------
Does this mean that "-ffp-model=precise -ffp-contract=off" will leave FP contraction on? That doesn't seem right.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2769
         DenormalFPMath != llvm::DenormalMode::getIEEE() &&
-        FPContract.empty())
+        (FPContract.equals("off") || FPContract.empty()))
         // OK: Current Arg doesn't conflict with -ffp-model=strict
----------------
We should never get here with FPContract empty.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74436





More information about the cfe-commits mailing list