This is an archive of the discontinued LLVM Phabricator instance.

Shrinkify libcalls: use float versions of double libm functions with fast-math (bug 17850)
ClosedPublic

Authored by spatel on Oct 21 2014, 2:38 PM.

Details

Summary

When a call to a double-precision libm function has fast-math semantics (via function attribute for now because there is no IR-level FMF on calls), we can avoid fpext/fptrunc operations and use the float version of the call if the input and output are both float.

We already do this optimization using a command-line option; this patch just adds the ability for fast-math to use the existing functionality.

I moved the cl::opt from InstructionCombining into SimplifyLibCalls because it's only ever used internally to that class.

Is it possible to conditionalize test case code from a RUN line? If yes, I could combine all of the new test cases with the existing test file instead of creating a new file.

This patch should solve: http://llvm.org/bugs/show_bug.cgi?id=17850

Diff Detail

Event Timeline

spatel updated this revision to Diff 15209.Oct 21 2014, 2:38 PM
spatel retitled this revision from to Shrinkify libcalls: use float versions of double libm functions with fast-math (bug 17850).
spatel updated this object.
spatel edited the test plan for this revision. (Show Details)
spatel added reviewers: hfinkel, beanz.
spatel added a subscriber: Unknown Object (MLST).
hfinkel accepted this revision.Oct 21 2014, 2:46 PM
hfinkel edited edge metadata.

LGTM, thanks!

Don't duplicate the tests... we don't need to test the command line option specifically, just remove those tests and add these.

This revision is now accepted and ready to land.Oct 21 2014, 2:46 PM
spatel closed this revision.Oct 22 2014, 8:40 AM
spatel updated this revision to Diff 15242.

Closed by commit rL220390 (authored by @spatel).