[NewPM] Fix MergeFunctions scheduling
authorNikita Popov <npopov@redhat.com>
Sat, 4 Dec 2021 12:14:15 +0000 (13:14 +0100)
committerNikita Popov <npopov@redhat.com>
Sat, 4 Dec 2021 16:30:30 +0000 (17:30 +0100)
commitae7f468073e448d9a5c39364a5cc4241525c4896
tree08be98eadfb01ced1cb7d610dc85e1f78a5155eb
parenta25111c9e2d9069248109429d0e2c091e2fd02e9
[NewPM] Fix MergeFunctions scheduling

MergeFunctions (as well as HotColdSplitting an IROutliner) are
incorrectly 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.

Differential Revision: https://reviews.llvm.org/D115098
llvm/lib/Passes/PassBuilderPipelines.cpp
llvm/test/Transforms/PhaseOrdering/X86/merge-functions.ll