This patch turns on the flag -enable-no-rerun-simplification-pipeline, which means the simplification pipeline will not be rerun on unchanged functions in the CGSCCPass Manager.
Compile time improvement:
https://llvm-compile-time-tracker.com/compare.php?from=17457be1c393ff691cca032b04ea1698fedf0301&to=882301ebb893c8ef9f09fe1ea871f7995426fa07&stat=instructions
No meaningful run time regressions observed in the llvm test suite and
in additional internal workloads at this time.
The example test in test/Other/no-rerun-function-simplification-pipeline.ll is a good means to understand the effect of this change:
define void @f1(void()* %p) alwaysinline { call void %p() ret void } define void @f2() #0 { call void @f1(void()* @f2) call void @f3() ret void } define void @f3() #0 { call void @f2() ret void }
There are two SCCs formed by the ModuleToPostOrderCGSCCAdaptor: (f1) and (f2, f3).
The pass manager runs on the first SCC, leading to running the simplification pipeline (function and loop passes) on f1. With the flag on, after this, the output will have Running analysis: ShouldNotRunFunctionPassesAnalysis on f1.
Next, the pass manager runs on the second SCC: (f2, f3). Since f1() was inlined, f2() now calls itself, and also calls f3(), while f3() only calls f2().
So the pass manager for the SCC first runs the Inliner on (f2, f3), then the simplification pipeline on f2.
With the flag on, the output will have Running analysis: ShouldNotRunFunctionPassesAnalysis on f2; unless the inliner makes a change, this analysis remains preserved which means there's no reason to rerun the simplification pipeline. With the flag off, there is a second run of the simplification pipeline run on f2.
Next, the same flow occurs for f3. The simplification pipeline is run on f3 a single time with the flag on, along with ShouldNotRunFunctionPassesAnalysis on f3, and twice with the flag off.
The reruns occur only on f2 and f3 due to the additional ref edges.