[PATCH] D121122: Set FLT_EVAL_METHOD to -1 when fast-math is enabled.

Andy Kaylor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 8 10:21:52 PST 2022


andrew.w.kaylor added a comment.

The fix for the eval_method crash should be moved to a separate patch. Otherwise, this looks good. I have only minor comments.



================
Comment at: clang/lib/Lex/PPMacroExpansion.cpp:1600
+    } else {
+      OS << getTUFPEvalMethod();
+      // __FLT_EVAL_METHOD__ expands to a simple numeric value.
----------------
It looks like you've got tabs in the code here.


================
Comment at: clang/lib/Sema/SemaAttr.cpp:521
+    // Fast-math is enabled.
+    PP.setCurrentFPEvalMethod(
+        Loc, LangOptions::FPEvalMethodKind::FEM_Indeterminable);
----------------
Why don't you need the reverse of this in the Precise and Pop cases? Also, why is it necessary to call getCurrentFPEvalMethod() immediately after setting it?


================
Comment at: clang/test/CodeGen/eval-method-fast-math.c:55
+  return __FLT_EVAL_METHOD__;
+}
----------------
Can you add a test that uses the float_control push and pop?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121122



More information about the cfe-commits mailing list