Skip to content

Commit dcc246b

Browse files
committed
[move-only] Add a call to indirectCleanup to make sure that we call llvm.lifetime.end when we emit a call to a deinit via the value witness table.
1 parent 1cf20fb commit dcc246b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/IRGen/GenType.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,6 +2901,7 @@ static bool tryEmitDeinitCall(IRGenFunction &IGF,
29012901
// If we do not have a deinit table, call the value witness instead.
29022902
if (!deinitTable) {
29032903
irgen::emitDestroyCall(IGF, T, indirect());
2904+
indirectCleanup();
29042905
return true;
29052906
}
29062907

test/IRGen/moveonly_split_module_source_deinit.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
// REFERRING_MODULE: [[DESTROY:%.*]] = bitcast i8* [[VALUE_WITNESS]]
1313
// REFERRING_MODULE: [[CAST_SERVER:%.*]] = bitcast %T6server8MoveOnlyV* [[SERVER]]
1414
// REFERRING_MODULE: call void [[DESTROY]]({{%.*}} [[CAST_SERVER]], {{%.*}} @"$s6server8MoveOnlyVN")
15+
// REFERRING_MODULE: [[CAST_SERVER:%.*]] = bitcast %T6server8MoveOnlyV* [[SERVER]]
16+
// REFERRING_MODULE: call void @llvm.lifetime.end.p0i8({{.*}}, i8* [[CAST_SERVER]])
17+
// REFERRING_MODULE-NEXT: ret void
1518

1619
// Make sure that in the other module, we do call the deinit directly from the value witness.
1720
// DEFINING_MODULE-LABEL: define internal void @"$s6server8MoveOnlyVwxx"(%swift.opaque* noalias %object, %swift.type* %MoveOnly) {{.*}} {

0 commit comments

Comments
 (0)