This is an archive of the discontinued LLVM Phabricator instance.

[NewPM] Fix MergeFunctions scheduling
ClosedPublic

Authored by nikic on Dec 4 2021, 6:09 AM.

Details

Summary

MergeFunctions (as well as HotColdSplitting an IROutliner) are incorrect scheduled under the new pass manager. The code makes it look like they run towards the end of the module optimization pipeline (as they should), while in reality the run at the start. This is because the OptimizePM populated around them is only scheduled later.

I'm fixing this by moving these three passes until after OptimizePM to avoid splitting the function pass pipeline. It doesn't seem important to me that some of the function passes run after these late module passes.

Diff Detail

Event Timeline

nikic created this revision.Dec 4 2021, 6:09 AM
nikic requested review of this revision.Dec 4 2021, 6:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 4 2021, 6:09 AM
fhahn accepted this revision.Dec 4 2021, 6:58 AM

LGTM, this looks like an oversight and is closer to the position in the legacy pass manager.

It doesn't seem important to me that some of the function passes run after these late module passes.

Agreed, it seems unlikely that those passes would enable much further optimizations by the function passes that run after them in the legacy PM.

This revision is now accepted and ready to land.Dec 4 2021, 6:58 AM
fhahn added a comment.Dec 4 2021, 7:10 AM

it would probably also good to have a pipeline ordering test that checks the placement of those extra passes

This revision was automatically updated to reflect the committed changes.
nikic added a comment.Dec 4 2021, 8:31 AM

it would probably also good to have a pipeline ordering test that checks the placement of those extra passes

Right. I've extended the default pipeline test to also cover these options in https://github.com/llvm/llvm-project/commit/8bd62119f9e9b0ee92cb7a78d1161e86293a8163.