[llvm-commits] [llvm] r81170 - /llvm/trunk/docs/LangRef.html
Török Edwin
edwintorok at gmail.com
Tue Sep 8 00:06:17 PDT 2009
On 2009-09-08 02:33, Chris Lattner wrote:
> Author: lattner
> Date: Mon Sep 7 18:33:52 2009
> New Revision: 81170
>
> URL: http://llvm.org/viewvc/llvm-project?rev=81170&view=rev
> Log:
> add some more notes.
>
> Modified:
> llvm/trunk/docs/LangRef.html
>
> Modified: llvm/trunk/docs/LangRef.html
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=81170&r1=81169&r2=81170&view=diff
>
> ==============================================================================
> --- llvm/trunk/docs/LangRef.html (original)
> +++ llvm/trunk/docs/LangRef.html Mon Sep 7 18:33:52 2009
> @@ -2118,7 +2118,46 @@
> so the value is not neccesarily consistent over time. In fact, %A and %C need
> to have the same semantics of the core LLVM "replace all uses with" concept
> would not hold.</p>
> -
> +
> +<div class="doc_code">
> +<pre>
> + %A = fdiv undef, %X
> + %B = fdiv %X, undef
> +Safe:
> + %A = undef
> +b: unreachable
> +</pre>
> +</div>
> +
> +<p>These examples show the crucial difference between an <em>undefined
> +value</em> and <em>undefined behavior</em>. An undefined value (like undef) is
> +allowed to have an arbitrary bit-pattern. This means that the %A operation
> +can be constant folded to undef because the undef could be an SNaN, and fdiv is
> +not (currently) defined on SNaN's. However, in the second example, we can make
> +a more aggressive assumption: because the undef is allowed to be an arbitrary
> +value, we are allowed to assume that it could be zero. Since a divide by zero
> +is has <em>undefined behavior</em>, we are allowed to assume that the operation
>
is has?
Best regards,
--Edwin
More information about the llvm-commits
mailing list