[LLVMdev] Optimize away sqrt in simple cases?
Owen Anderson
resistor at mac.com
Tue Apr 23 13:26:19 PDT 2013
That's a pretty seriously unsafe floating point optimization. It could be done in fast-math mode, but I doubt we currently do it.
--Owen
On Apr 23, 2013, at 1:12 PM, Erkki Lindpere <villane at gmail.com> wrote:
> hi!
>
> I'm using LLVM 3.2. Does it optimize away llvm.pow(llvm.sqrt(x), 2) to `x` with any settings? I tried with llc -O3, but that didn't do it.
>
> Would be nice to write |v|² in my language ('v' being a 2D vector say and |...| and ...² being two separate infix "operators") -- when I could compare squares of lengths as well as lengths, and know that the sqrt is optimized away.
>
> Erkki
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list