This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyLibCalls] pow(x, -0.5) -> 1.0 / sqrt(x)
ClosedPublic

Authored by davide on Jan 9 2017, 1:25 PM.

Diff Detail

Event Timeline

davide updated this revision to Diff 83682.Jan 9 2017, 1:25 PM
davide retitled this revision from to [SimplifyLibCalls] pow(x, -0.5) -> 1.0 / sqrt(x).
davide updated this object.
davide added reviewers: spatel, majnemer.
davide added a subscriber: llvm-commits.
majnemer added inline comments.Jan 9 2017, 1:35 PM
lib/Transforms/Utils/SimplifyLibCalls.cpp
1084–1085

Doesn't hasUsnafeAlgebra make this irrelevant?

efriedma added inline comments.
lib/Transforms/Utils/SimplifyLibCalls.cpp
1089

Missing fast-math flags on sqrt() call and fdiv instruction.

davide updated this revision to Diff 83688.Jan 9 2017, 1:49 PM

Oops, thanks for spotting the mistake, Eli.

davide added a subscriber: hfinkel.Jan 9 2017, 1:52 PM
davide added inline comments.
lib/Transforms/Utils/SimplifyLibCalls.cpp
1084–1085

Does it? I'm not entirely sure of the implications, see e.g. http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160808/380416.html @hfinkel
(I'd leave the lowering to an intrinsic as a follow-up).

1089

Fixed, my bad.

davide removed a subscriber: efriedma.
majnemer added inline comments.Jan 9 2017, 2:03 PM
lib/Transforms/Utils/SimplifyLibCalls.cpp
1084–1085

Of course... Sorry about that!

majnemer accepted this revision.Jan 9 2017, 2:03 PM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jan 9 2017, 2:03 PM
This revision was automatically updated to reflect the committed changes.