This is an archive of the discontinued LLVM Phabricator instance.

[CSSPGO] Add switch for sample loader to honor global pre-inliner decision from llvm-profgen
ClosedPublic

Authored by wenlei on Aug 24 2021, 5:35 PM.

Details

Summary

The change adds a switch to allow sample loader to use global pre-inliner's decision instead. The pre-inliner in llvm-profgen makes inline decision globally based on whole program profile and function byte size as cost proxy.

Since pre-inliner also adjusts/merges context profile based on its inline decision, honoring its inline decision in sample loader would lead to better post-inline profile quality especially for thinlto where cross module profile merging isn't possible without pre-inliner.

Minor fix in profile reader is also included. When pre-inliner is use, we now also turn off the default merging and trimming logic unless it's explicitly asked.

Diff Detail

Event Timeline

wenlei created this revision.Aug 24 2021, 5:35 PM
wenlei requested review of this revision.Aug 24 2021, 5:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2021, 5:35 PM
hoy added a comment.Aug 25 2021, 9:57 AM

Can you add a test ?

llvm/lib/ProfileData/SampleProfReader.cpp
796

Nit: assert((!CSProfileCount || ProfileIsCS ) && ... ?

llvm/lib/Transforms/IPO/SampleProfile.cpp
1269

typo; assming -> assuming

wenlei added inline comments.Aug 25 2021, 4:04 PM
llvm/lib/ProfileData/SampleProfReader.cpp
796

that's better, changed.

llvm/lib/Transforms/IPO/SampleProfile.cpp
1269

done.

wenlei updated this revision to Diff 368770.Aug 25 2021, 4:08 PM

address comment, move preinliner check after always/never inline check, add test.

hoy accepted this revision.Aug 25 2021, 5:02 PM

lgtm

This revision is now accepted and ready to land.Aug 25 2021, 5:02 PM
This revision was landed with ongoing or failed builds.Aug 25 2021, 5:25 PM
This revision was automatically updated to reflect the committed changes.