This is an archive of the discontinued LLVM Phabricator instance.

[CSSPGO][Preinliner] Always inline zero-sized functions.
ClosedPublic

Authored by hoy on Jun 26 2023, 3:42 PM.

Details

Summary

Zero-sized functions should be cost-free in term of size budget, so they should be considered during inlining even if we run out of size budget.

This appears to give 0.5% win for one of our internal services.

Diff Detail

Event Timeline

hoy created this revision.Jun 26 2023, 3:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 26 2023, 3:42 PM
hoy requested review of this revision.Jun 26 2023, 3:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 26 2023, 3:42 PM
hoy edited the summary of this revision. (Show Details)Jun 26 2023, 3:43 PM
hoy added reviewers: wenlei, wlei.

Can this be achieved by simply tweaking ProfiledCandidateComparer so zero SizeCost candidate always comes before non-zero ones?

hoy added a comment.Jun 27 2023, 4:45 PM

Can this be achieved by simply tweaking ProfiledCandidateComparer so zero SizeCost candidate always comes before non-zero ones?

Good idea!

hoy updated this revision to Diff 535189.Jun 27 2023, 4:45 PM

Updating D153820: [CSSPGO][Preinliner] Always inline zero-sized functions.

wenlei accepted this revision.Jun 27 2023, 4:54 PM

lgtm, thanks.

llvm/tools/llvm-profgen/CSPreInliner.h
47–48

nit: merge the two ifs into a single line?

if ((LHS.SizeCost == 0 || RHS.SizeCost == 0) && LHS.SizeCost != RHS.SizeCost)
    return return RHS.SizeCost == 0;
This revision is now accepted and ready to land.Jun 27 2023, 4:54 PM
hoy updated this revision to Diff 535198.Jun 27 2023, 5:05 PM

Updating D153820: [CSSPGO][Preinliner] Always inline zero-sized functions.

This revision was landed with ongoing or failed builds.Jun 27 2023, 5:12 PM
This revision was automatically updated to reflect the committed changes.