[PATCH] D30582: [Driver] Restructure handling of -ffast-math and similar options

Renato Golin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 14 06:17:24 PDT 2017


rengolin added inline comments.


================
Comment at: lib/Driver/ToolChains/Clang.cpp:2320
+
+  for (Arg *A : Args)
+  {
----------------
format


================
Comment at: lib/Driver/ToolChains/Clang.cpp:2324
+    {
+    // Options controlling individual features
+    case options::OPT_fhonor_infinities:    HonorInfs = true;        break;
----------------
default should be the first item, for readability.


================
Comment at: lib/Driver/ToolChains/Clang.cpp:2382
+      if (!OFastEnabled)
+        continue;
+    case options::OPT_ffast_math:
----------------
Use `LLVM_FALLTHROUGH`


================
Comment at: lib/Driver/ToolChains/Clang.cpp:2452
+  if (!HonorInfs && !HonorNans && !MathErrno && AssociativeMath &&
+      ReciprocalMath && !SignedZeros && !TrappingMath && FpContract == "fast")
+    CmdArgs.push_back("-ffast-math");
----------------
This is technically correct, but users will be confused if they choose `-ffast-math -ffp-contract=on` and not see `-ffast-math` coming out on the other side.

Also, `fp-contract=on` doesn't preclude `-ffast-math` for the languages that support it, so I wouldn't add `FpContract` to this list at all.


Repository:
  rL LLVM

https://reviews.llvm.org/D30582





More information about the cfe-commits mailing list