[PATCH] D79903: FastMathFlags.allowContract should be init from FPFeatures.allowFPContractAcrossStatement

Melanie Blower via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 13 13:03:57 PDT 2020


mibintc marked 3 inline comments as done.
mibintc added a comment.

added some inline explanation



================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:2943
+  if (Opts.FastRelaxedMath)
+    Opts.setDefaultFPContractMode(LangOptions::FPM_Fast);
   Opts.HexagonQdsp6Compat = Args.hasArg(OPT_mqdsp6_compat);
----------------
I changed this because the FAST version of this test clang/test/CodeGenOpenCL/relaxed-fpmath.cl wants the 'fast' attribute on the instruction dump.  All the LLVM FMF bits must be set for the fast attribute print.  By default, the value for OpenCL is ffp-contract=on


================
Comment at: clang/lib/Sema/SemaAttr.cpp:460
   case PFC_Push:
-    Action = Sema::PSK_Push_Set;
-    FpPragmaStack.Act(Loc, Action, StringRef(), NewFPFeatures.getAsOpaqueInt());
+    if (FpPragmaStack.Stack.empty()) {
+      FpPragmaStack.Act(Loc, Sema::PSK_Set, StringRef(),
----------------
When i was adding a test, I realized that pragma float_control(push) then pop wasn't working as expected. If the stack is empty, which is most of the time, first need to push the current fp features onto the stack so they can be restored at the pop


================
Comment at: clang/test/CodeGen/constrained-math-builtins.c:157
 
-  // CHECK: call contract float @llvm.experimental.constrained.fmuladd.f32
+  // CHECK: call float @llvm.experimental.constrained.fmuladd.f32
   // CHECK: fneg
----------------
most of the test changes here are just a revert of the test changes from the original patch for float_control


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79903





More information about the cfe-commits mailing list