Skip to content

Commit f4f2ca1

Browse files
committed
SIL Optimizer: add the OptimizeHopToExecutor in the late pipeline.
This is important to remove redundant `hop_to_executor` instructions after inlining. rdar://95796233
1 parent 0fdba62 commit f4f2ca1

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ static void addLateLoopOptPassPipeline(SILPassPipelinePlan &P) {
793793
// - don't require IRGen information.
794794
static void addLastChanceOptPassPipeline(SILPassPipelinePlan &P) {
795795
// Optimize access markers for improved IRGen after all other optimizations.
796+
P.addOptimizeHopToExecutor();
796797
P.addAccessEnforcementReleaseSinking();
797798
P.addAccessEnforcementOpts();
798799
P.addAccessEnforcementWMO();

test/Concurrency/Runtime/exclusivity_custom_executors.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ struct Runner {
376376

377377
await withExclusiveAccessAsync(to: &global) {
378378
@MyMainActorWithAccessInUnownedExecAccessor (x: inout Int) async -> Void in
379+
print("do something to avoid optimizing away to executor switch")
379380
debugLog("==> Making sure can push/pop access")
380381
}
381382
// In order to test that we properly hand off the access, we

0 commit comments

Comments
 (0)