Skip to content

Commit 010f6ef

Browse files
authored
SIL Optimizer: add the OptimizeHopToExecutor in the late pipeline. (#60156)
This is important to remove redundant `hop_to_executor` instructions after inlining. rdar://95796233
1 parent 9e3035f commit 010f6ef

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
@@ -767,6 +767,7 @@ static void addLateLoopOptPassPipeline(SILPassPipelinePlan &P) {
767767
// - don't require IRGen information.
768768
static void addLastChanceOptPassPipeline(SILPassPipelinePlan &P) {
769769
// Optimize access markers for improved IRGen after all other optimizations.
770+
P.addOptimizeHopToExecutor();
770771
P.addAccessEnforcementReleaseSinking();
771772
P.addAccessEnforcementOpts();
772773
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)