This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Separate MachineFunctionSplitter logic for different profile types
ClosedPublic

Authored by shenhan on Jul 13 2023, 5:31 PM.

Details

Summary

In D152577 @xur has a post-submit comment regarding to an awkward usage of MFS for Autofdo - instead of just using -fsplit-machine-function, the user needs to add "-mllvm -mfs-psi-cutoff=0" to choose the right logic for AutoFDO. The compiler should choose the right default values for such case.

This CL separate MFS logic for different profile types.

Diff Detail

Unit TestsFailed

Event Timeline

shenhan created this revision.Jul 13 2023, 5:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 5:31 PM
shenhan requested review of this revision.Jul 13 2023, 5:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 5:31 PM
wenlei added inline comments.Jul 13 2023, 6:40 PM
llvm/lib/CodeGen/MachineFunctionSplitter.cpp
112

Can we just use query PSI directly? PSI has the following API, which should be sufficient and we should be able to avoid passing ProfileKind around.

PSI->hasSampleProfile()
PSI->hasInstrumentationProfile()
PSI->hasCSInstrumentationProfile()
126

This is common code that can be sinked out of the switch.

shenhan updated this revision to Diff 540564.Jul 14 2023, 2:49 PM
shenhan updated this revision to Diff 540566.
shenhan marked 2 inline comments as done.
wenlei accepted this revision.Jul 14 2023, 3:07 PM

lgtm, thanks.

This revision is now accepted and ready to land.Jul 14 2023, 3:08 PM
xur accepted this revision.Jul 17 2023, 1:46 PM

looks good to me.