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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 11:16:33 PST 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/Sema/Sema.cpp:258
+  // Fast-math is enabled.
+  if (getLangOpts().AllowFPReassoc || getLangOpts().AllowRecip)
+    PP.setCurrentFPEvalMethod(SourceLocation(),
----------------
zahiraam wrote:
> 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.
> 
> 
Okay, then I think the comments about fast math should be fixed up; otherwise that's going to get confusing.


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

https://reviews.llvm.org/D121122



More information about the cfe-commits mailing list