[PATCH] D47963: [LangRef] Clarify that nnan and ninf don't produce undef or poison.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 8 15:33:08 PDT 2018


efriedma created this revision.
efriedma added reviewers: spatel, hfinkel, nlopes.

This is intentionally limited so programs produce somewhat understandable results, instead of undefined behavior, when nnan or ninf is violated.

We don't quite succeed in avoiding undefined behavior when float-to-int casts are involved: nnan and ninf affect fcmp, so it's impossible to guard a cast correctly if a computation produces Inf or NaN somehow. But I'm not sure what we could do to solve that.


Repository:
  rL LLVM

https://reviews.llvm.org/D47963

Files:
  docs/LangRef.rst


Index: docs/LangRef.rst
===================================================================
--- docs/LangRef.rst
+++ docs/LangRef.rst
@@ -2343,12 +2343,14 @@
 ``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.
+   NaNs, but the value of the result is unspecified. The unspecified result
+   may not be the same each time the expression is evaluated.
 
 ``ninf``
    No Infs - Allow optimizations to assume the arguments and result are not
    +/-Inf. Such optimizations are required to retain defined behavior over
-   +/-Inf, but the value of the result is undefined.
+   +/-Inf, but the value of the result is unspecified. The unspecified result
+   may not be the same each time the expression is evaluated.
 
 ``nsz``
    No Signed Zeros - Allow optimizations to treat the sign of a zero


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47963.150579.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180608/240b3305/attachment-0001.bin>


More information about the llvm-commits mailing list