[PATCH] D50895: [SimplifyLibCalls] Generalize replacePowWithSqrt to handle more cases.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 17 06:47:31 PDT 2018


fhahn created this revision.
fhahn added reviewers: paulwalker-arm, wmi, efriedma, evandro, spatel.

This patch folds the logic to expand

- pow(x, 0.5) to (x == -infinity ? +infinity : fabs(sqrt(x)))

into replacePowWithSqrt. If the original pow has NoInfs, we do not need
the select, if it has NoSignedZero, we do not need the fabs.

This addresses several FIXMEs in test/Transforms/InstCombine/pow-sqrt.ll.

One thing I am not entirely sure about: did we need isFast() in the original code for anything besides NoInfs and NoUnsignedZeros (e.g. errno behavior)?


https://reviews.llvm.org/D50895

Files:
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  test/Transforms/InstCombine/pow-1.ll
  test/Transforms/InstCombine/pow-sqrt.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50895.161232.patch
Type: text/x-patch
Size: 11451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180817/d9d68e29/attachment.bin>


More information about the llvm-commits mailing list