[LLVMdev] Optimize away sqrt in simple cases?

Erkki Lindpere villane at gmail.com
Tue Apr 23 13:12:58 PDT 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130423/d9fa4a4e/attachment.html>


More information about the llvm-dev mailing list