[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 cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 21 11:25:39 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);
----------------
mibintc wrote:
> mibintc wrote:
> > 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
> Oops I'm wrong. @kbsmith1 tells me only the reassoc bit is interesting. i'll need to fix this in the documentation etc. Thanks for your careful reading.
BTW in the options parsing, any of the unsafe fp math options freciprocal-math, fsigned-zeros and fapprox-func have the effect of enabing LangOptions.AllowFPReassoc. This is in the file Options.td
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100118/new/
https://reviews.llvm.org/D100118
More information about the cfe-commits
mailing list