[PATCH] D88987: [FPEnv][Clang][Driver] Use MarshallingInfoFlag for -fexperimental-strict-floating-point

Kevin P. Neal via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 10:38:01 PDT 2020


kpn created this revision.
kpn added a reviewer: dang.
kpn added a project: clang.
Herald added subscribers: cfe-commits, dexonsmith.
kpn requested review of this revision.

As of D80952 <https://reviews.llvm.org/D80952> we are disabling strict floating point on all hosts except those that are explicitly listed as supported. Use of strict floating point on other hosts requires use of the -fexperimental-strict-floating-point flag. This is to avoid bugs like "https://bugs.llvm.org/show_bug.cgi?id=45329" (which has an incorrect link in the previous review).

In the review for D80952 <https://reviews.llvm.org/D80952> I was asked to mark the -fexperimental option as a MarshallingInfoFlag. This patch does exactly that.

The previous tests continue to work correctly so I haven't included a new one here. I can if needed, but I would need guidance since I don't know what would need to be tested.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88987

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3309,9 +3309,6 @@
       Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
   }
 
-  if (Args.hasArg(OPT_fexperimental_strict_floating_point))
-    Opts.ExpStrictFP = true;
-
   auto FPRM = llvm::RoundingMode::NearestTiesToEven;
   if (Args.hasArg(OPT_frounding_math)) {
     FPRM = llvm::RoundingMode::Dynamic;
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1282,7 +1282,8 @@
   HelpText<"Enables an experimental new pass manager in LLVM.">;
 def fexperimental_strict_floating_point : Flag<["-"], "fexperimental-strict-floating-point">,
   Group<f_clang_Group>, Flags<[CC1Option]>,
-  HelpText<"Enables experimental strict floating point in LLVM.">;
+  HelpText<"Enables experimental strict floating point in LLVM.">,
+  MarshallingInfoFlag<"LangOpts->ExpStrictFP", "false">;
 def finput_charset_EQ : Joined<["-"], "finput-charset=">, Group<f_Group>;
 def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group<f_Group>;
 def finstrument_functions : Flag<["-"], "finstrument-functions">, Group<f_Group>, Flags<[CC1Option]>,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88987.296733.patch
Type: text/x-patch
Size: 1419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201007/f1020642/attachment.bin>


More information about the cfe-commits mailing list