Skip to content

Commit 5c507eb

Browse files
authored
Fix debug scope for SIL instructions created in LowerHopToActor (swiftlang#38802)
The pass uses SILBuilder instant to create instructions and does not set SILDebugScope. Due to this, SILVerifier correctly asserts that basic blocks contain non-contiguous lexical scopes at -Onone. The long term fix would be to replace SILBuilder instance in the pass with SILBuilderContext and use SILBuilderWithScope so that such bugs do not come up.
1 parent c92805e commit 5c507eb

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/SILOptimizer/Mandatory/LowerHopToActor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ bool LowerHopToActor::processHop(HopToExecutorInst *hop) {
100100
return false;
101101

102102
B.setInsertionPoint(hop);
103+
B.setCurrentDebugScope(hop->getDebugScope());
103104

104105
// Get the dominating executor value for this actor, if available,
105106
// or else emit code to derive it.
@@ -117,6 +118,7 @@ bool LowerHopToActor::processExtract(ExtractExecutorInst *extract) {
117118
auto executor = extract->getExpectedExecutor();
118119
if (!isOptionalBuiltinExecutor(executor->getType())) {
119120
B.setInsertionPoint(extract);
121+
B.setCurrentDebugScope(extract->getDebugScope());
120122
executor = emitGetExecutor(extract->getLoc(), executor, /*optional*/false);
121123
}
122124

test/Concurrency/Runtime/actor_counters.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library)
1+
// RUN: %target-run-simple-swift( -Xfrontend -sil-verify-all -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library)
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

0 commit comments

Comments
 (0)