[PATCH] fold: sqrt(x * x * y) -> fabs(x) * sqrt(y)

Sanjay Patel spatel at rotateright.com
Wed Oct 15 13:09:29 PDT 2014


Code and regression tests updated to use a function-level attribute to enable the optimization.

Note that the existing optimization to do (X*Y) * X => (X*X) * Y in InstCombineMulDivRem also needs to detect the function-level attribute, otherwise it won't reassociate the factors to the square root into the canonical form.

http://reviews.llvm.org/D5787

Files:
  include/llvm/Transforms/Utils/SimplifyLibCalls.h
  lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  test/Transforms/InstCombine/fast-math.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5787.14960.patch
Type: text/x-patch
Size: 12504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141015/e734e7b7/attachment.bin>


More information about the llvm-commits mailing list