[PATCH] D121122: Set FLT_EVAL_METHOD to -1 when fast-math is enabled.
Zahira Ammarguellat via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 10 11:12:09 PST 2022
zahiraam added inline comments.
================
Comment at: clang/lib/Sema/Sema.cpp:258
+ // Fast-math is enabled.
+ if (getLangOpts().AllowFPReassoc || getLangOpts().AllowRecip)
+ PP.setCurrentFPEvalMethod(SourceLocation(),
----------------
aaron.ballman wrote:
> Shouldn't this be looking at `getLangOpts().FastMath`?
when the -ffast-math is enabled on the command line, it triggers all these math driver options:
"-menable-no-infs" "-menable-no-nans" "-fapprox-func" "-menable-unsafe-fp-math" "-fno-signed-zeros" "-mreassociate" "-freciprocal-math" "-ffp-contract=fast" "-ffast-math" "-ffinite-math-only"
That's a bit restrictive. We want the eval-method set to -1 when either reassoc or allowrecip are enabled.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121122/new/
https://reviews.llvm.org/D121122
More information about the cfe-commits
mailing list