[PATCH] InstCombine: cannot fold "fcmp x, undef" because x can be NaN
hfinkel at anl.gov
hfinkel at anl.gov
Mon Feb 16 02:25:10 PST 2015
> I wonder if we could access the target machine specific info to know
> if NaN are disabled?
> Or what is the right way of getting the -enable-no-nans-fp-math in opt?
Check the fast-math flags on the the operand (call Op->getFastMathFlags()). The LangRef says:
> LLVM IR floating-point binary ops (fadd, fsub, fmul, fdiv, frem) have the following flags that can set to enable otherwise unsafe floating point operations
> ...
> nnan - No NaNs - Allow optimizations to assume the arguments and result are not NaN. Such optimizations are required to retain defined behavior over NaNs, but the value of the result is undefined.
> ...
> fast - Fast - Allow algebraically equivalent transformations that may dramatically change results in floating point (e.g. reassociate). This flag implies all the others.
For constant values, you can call C->isNaN();
http://reviews.llvm.org/D7617
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list