Skip to content

Commit e0c4fa2

Browse files
committed
SILOptimizer: add a LICM pass at mid-level in the pass pipeline.
It's needed to hoist global_init calls.
1 parent 71eebaa commit e0c4fa2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ static bool addMidLevelPassPipeline(SILPassPipelinePlan &P) {
453453
// for CapturePropagation.
454454
P.addDeadArgSignatureOpt();
455455

456+
// A LICM pass at mid-level is mainly needed to hoist addressors of globals.
457+
// It needs to be before global_init functions are inlined.
458+
P.addLICM();
456459
// Run loop unrolling after inlining and constant propagation, because loop
457460
// trip counts may have became constant.
458461
P.addLoopUnroll();

0 commit comments

Comments
 (0)