[LLVMdev] Optimize away sqrt in simple cases?

Owen Anderson resistor at mac.com
Wed Apr 24 00:41:17 PDT 2013

On Apr 24, 2013, at 12:36 AM, Stephen Lin <swlin at post.harvard.edu> wrote:

> By the way, I definitely believe you that this isn't a 100% safe
> optimization, but I'm curious, is this really guaranteed here that c
> will not be a non-zero finite value? I was under the impression that
> FPU state could lead to slightly different results in these kinds of
> cases, so one should almost never rely on the result of a computation
> being exactly zero (outside of some simple primitive cases).

That's a common misconception.  Floating point computations are deterministic and a function only of their inputs (and a couple of modal switches like rounding mode).  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130424/ffba8a29/attachment.html>

More information about the llvm-dev mailing list