[PATCH] D100118: [clang] RFC Support new builtin __arithmetic_fence to control floating point optimization, and new clang option fprotect-parens

Melanie Blower via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 11:19:07 PDT 2021


mibintc added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2844
+      return RValue::get(
+          Builder.CreateArithmeticFence(ArgValue, ConvertType(ArgType)));
+    return RValue::get(ArgValue);
----------------
kpn wrote:
> Does this say that the fence will be silently dropped if any of the fast math flags are disabled? Silently dropping something used for correctness makes me nervous. Is there a case where all of these flags are required for correct behavior of the fence?
Yes that is the idea, the clang builtin is only meaningful for float operations when -ffast-math is enabled.  If fast math isn't enabled then the operations should already be performed strictly.  I didn't have "isFast", should rewrite with isFast to make it easier to understand 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100118



More information about the llvm-commits mailing list