This is an archive of the discontinued LLVM Phabricator instance.

SimplifyLibCalls: Remove checks for fabs
ClosedPublic

Authored by arsenm on Jan 7 2017, 8:22 PM.

Details

Reviewers
efriedma
Summary

Use the intrinsic instead of emitting the libcall which
will be replaced by the intrinsic.

There are some additional places using this like ConstantFolding that may want to stay

Diff Detail

Event Timeline

arsenm updated this revision to Diff 83546.Jan 7 2017, 8:22 PM
arsenm retitled this revision from to SimplifyLibCalls: Remove checks for fabs.
arsenm updated this object.
arsenm added a reviewer: efriedma.
arsenm added a subscriber: llvm-commits.
davide added a subscriber: davide.Jan 7 2017, 8:35 PM
davide added inline comments.
lib/Transforms/Utils/SimplifyLibCalls.cpp
1100–1103

You can fold Callee->getParent() as the first argument of getDeclaration because it has only one use, no?

arsenm added inline comments.Jan 7 2017, 8:37 PM
lib/Transforms/Utils/SimplifyLibCalls.cpp
1100–1103

I usually prefer always using variables to avoid uglier line wraps

davide added a comment.Jan 7 2017, 8:38 PM

I expected
define float @test_simplify7(float %x) {
in InstCombine/pow-1.ll to be updated, does it still pass?

arsenm added a comment.Jan 7 2017, 8:41 PM

I expected
define float @test_simplify7(float %x) {
in InstCombine/pow-1.ll to be updated, does it still pass?

The same change is done in D28405 since the call is later replaced

efriedma accepted this revision.Jan 9 2017, 11:57 AM
efriedma edited edge metadata.

LGTM with a minor tweak.

There are some additional places using this like ConstantFolding that may want to stay

I don't see why this would be worth keeping. instcombine will transform fabs(const)->llvm.fabs(const)->const.

test/Transforms/InstCombine/win-math.ll
277

Update this comment to reflect the fact that we aren't calling fabsf?

This revision is now accepted and ready to land.Jan 9 2017, 11:57 AM
arsenm closed this revision.Jan 16 2017, 4:43 PM

r292176