This is an archive of the discontinued LLVM Phabricator instance.

[Inliner] Restrict soft-float inlining penalty.
ClosedPublic

Authored by efriedma on Dec 21 2017, 2:42 PM.

Details

Summary

The penalty is currently getting applied in a bunch of places where it doesn't make sense, like bitcasts (which are free) and calls (which were getting the call penalty applied twice). Instead, just apply the penalty to binary operators and floating-point casts.

While I'm here, also fix getFPOpCost() to do the right thing in more cases, so we don't have to dig into function attributes.

(Not sure if I should also apply this to fcmp instructions.)

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Dec 21 2017, 2:42 PM
echristo added inline comments.Dec 21 2017, 3:57 PM
lib/Analysis/InlineCost.cpp
1103 ↗(On Diff #127945)

I realize you're just moving this code, but we might want to make this a TTI backend call for the function since there's also the subtarget feature on some targets as well.

Would it make since for this to be a part of getFPOpCost instead?

efriedma updated this revision to Diff 127974.Dec 21 2017, 5:42 PM
efriedma edited the summary of this revision. (Show Details)

Fixed getFPOpCost().

efriedma added inline comments.Dec 21 2017, 5:55 PM
lib/Analysis/InlineCost.cpp
1103 ↗(On Diff #127945)

I think this code was originally written before we had per-function TTI... but we should take advantage of it now. Fixed the default implementation of getFPOpCost to do the right thing, and removed the explicit check for "use-soft-float".

echristo accepted this revision.Dec 21 2017, 5:58 PM

LGTM, thanks!

This revision is now accepted and ready to land.Dec 21 2017, 5:58 PM
This revision was automatically updated to reflect the committed changes.