This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyLibCalls] Generalize replacePowWithSqrt to handle more cases.
AbandonedPublic

Authored by fhahn on Aug 17 2018, 6:47 AM.

Details

Summary

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)?

Diff Detail

Event Timeline

fhahn created this revision.Aug 17 2018, 6:47 AM

Is this identical to D50036 / rL339887?

fhahn abandoned this revision.Aug 17 2018, 7:56 AM

Yep it is. What a coincidence :)