Skip to content

Commit 490e7f5

Browse files
authored
Merge pull request #63891 from adrian-prantl/105701833-5.8
SIL: Use a scoped SILBuilder to insert dealloc_stacks for closure captures.
2 parents 79f282e + fadfeda commit 490e7f5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/SILOptimizer/Utils/InstOptUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ void swift::insertDeallocOfCapturedArguments(PartialApplyInst *pai,
15071507
} else {
15081508
insertionPoint = terminator;
15091509
}
1510-
auto builder = SILBuilder(insertionPoint);
1510+
SILBuilderWithScope builder(insertionPoint);
15111511
builder.createDeallocStack(CleanupLocation(insertionPoint->getLoc()),
15121512
arg.get());
15131513
}

test/SILOptimizer/closure-lifetime-fixup.sil

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -enable-sil-verify-all -closure-lifetime-fixup %s | %FileCheck %s
1+
// RUN: %target-sil-opt -enable-sil-verify-all -sil-print-debuginfo -closure-lifetime-fixup %s | %FileCheck %s
22

33
sil_stage raw
44

@@ -261,16 +261,16 @@ bb3:
261261
// CHECK: [[STACK:%[^,]+]] = alloc_stack $Self
262262
// CHECK: try_apply undef() {{.*}}, normal [[SUCCESS_1:bb[0-9]+]], error [[FAILURE_1:bb[0-9]+]]
263263
// CHECK: [[SUCCESS_1]]
264-
// CHECK: copy_addr [[INSTANCE]] to [init] [[STACK]] : $*Self
264+
// CHECK: copy_addr [[INSTANCE]] to [init] [[STACK]] : $*Self, {{.*}} scope [[STACK_SCOPE:[0-9]+]]
265265
// CHECK: [[CLOSURE:%[^,]+]] = partial_apply [callee_guaranteed] [on_stack] undef<Self>([[STACK]])
266266
// CHECK: [[DEPENDENCY:%[^,]+]] = mark_dependence [[CLOSURE]] {{.*}} on [[STACK]]
267267
// CHECK: try_apply undef([[DEPENDENCY]]) {{.*}}, normal [[SUCCESS_2:bb[0-9]+]], error [[FAILURE_2:bb[0-9]+]]
268268
// CHECK: [[SUCCESS_2]]
269269
// CHECK: dealloc_stack [[CLOSURE]]
270270
// CHECK: destroy_addr [[STACK]]
271-
// CHECK: dealloc_stack [[STACK]] : $*Self
271+
// CHECK: dealloc_stack [[STACK]] : $*Self, {{.*}} scope [[STACK_SCOPE]]
272272
// CHECK: [[FAILURE_1]]
273-
// CHECK: dealloc_stack [[STACK]]
273+
// CHECK: dealloc_stack [[STACK]] : $*Self, {{.*}} scope [[STACK_SCOPE]]
274274
// CHECK: throw
275275
// CHECK: [[FAILURE_2]]
276276
// CHECK-NOT: dealloc_stack

0 commit comments

Comments
 (0)