This is an archive of the discontinued LLVM Phabricator instance.

optimize away fabs calls when input is known positive
ClosedPublic

Authored by spatel on Oct 14 2014, 10:03 AM.

Details

Summary

This patch eliminates library calls and intrinsic calls to fabs when the input is a squared value.
This pattern will occur when a subsequent patch that I am working on to optimize sqrt calls is introduced, so I thought it'd be better to send this one out for review first because it's smaller.
Note that no unsafe-math / fast-math assumptions are needed for this optimization.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 14875.Oct 14 2014, 10:03 AM
spatel retitled this revision from to optimize away fabs calls when input is known positive.
spatel updated this object.
spatel edited the test plan for this revision. (Show Details)
spatel added reviewers: hfinkel, beanz, resistor.
spatel added a subscriber: Unknown Object (MLST).
beanz accepted this revision.Oct 14 2014, 1:03 PM
beanz edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Oct 14 2014, 1:03 PM

Thanks, Chris!

spatel closed this revision.Oct 14 2014, 1:53 PM
spatel updated this revision to Diff 14888.

Closed by commit rL219717 (authored by @spatel).