Skip to content

Commit f386dd0

Browse files
committed
[ome] Run even on deserialized functions.
This is needed since we are going to start eliminating ownership after SIL is serialized. So we need to make sure that we strip those as well. In terms of compile time, this shouldn't have much of an effect since we already skip functions that already have ownership stripped.
1 parent 9b0a94f commit f386dd0

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

lib/SILOptimizer/Transforms/OwnershipModelEliminator.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,6 @@ struct OwnershipModelEliminator : SILModuleTransform {
293293
}
294294

295295
for (auto &F : *getModule()) {
296-
// Don't rerun early lowering on deserialized functions.
297-
if (F.wasDeserializedCanonical())
298-
continue;
299-
300296
// If F does not have ownership, skip it. We have no further work to do.
301297
if (!F.hasOwnership())
302298
continue;

test/SILOptimizer/ownership_model_eliminator.sil

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,21 @@ bb0:
281281
() = destructure_tuple %1 : $()
282282
return %1 : $()
283283
}
284+
285+
// CHECK-LABEL: sil [canonical] @test_destructure_struct_tuple_canonical : $@convention(thin) (@owned (Builtin.NativeObject, Builtin.Int32), @owned TestArray2) -> @owned (Builtin.NativeObject, Builtin.Int32, TestArrayStorage, Builtin.Int32, TestArrayStorage) {
286+
// CHECK: bb0([[TUPLE:%.*]] : $(Builtin.NativeObject, Builtin.Int32), [[STRUCT:%.*]] : $TestArray2):
287+
// CHECK: [[TUP_ELT_0:%.*]] = tuple_extract [[TUPLE]] : $(Builtin.NativeObject, Builtin.Int32), 0
288+
// CHECK: [[TUP_ELT_1:%.*]] = tuple_extract [[TUPLE]] : $(Builtin.NativeObject, Builtin.Int32), 1
289+
// CHECK: [[STRUCT_FIELD_0:%.*]] = struct_extract [[STRUCT]] : $TestArray2, #TestArray2.storage
290+
// CHECK: [[STRUCT_FIELD_1:%.*]] = struct_extract [[STRUCT]] : $TestArray2, #TestArray2.someValue
291+
// CHECK: [[STRUCT_FIELD_2:%.*]] = struct_extract [[STRUCT]] : $TestArray2, #TestArray2.storage2
292+
// CHECK: [[RESULT:%.*]] = tuple ([[TUP_ELT_0]] : {{.*}}, [[TUP_ELT_1]] : {{.*}}, [[STRUCT_FIELD_0]] : {{.*}}, [[STRUCT_FIELD_1]] : {{.*}}, [[STRUCT_FIELD_2]] : {{.*}})
293+
// CHECK: return [[RESULT]]
294+
// CHECK: } // end sil function 'test_destructure_struct_tuple_canonical'
295+
sil [canonical] [ossa] @test_destructure_struct_tuple_canonical : $@convention(thin) (@owned (Builtin.NativeObject, Builtin.Int32), @owned TestArray2) -> @owned (Builtin.NativeObject, Builtin.Int32, TestArrayStorage, Builtin.Int32, TestArrayStorage) {
296+
bb0(%0 : @owned $(Builtin.NativeObject, Builtin.Int32), %1 : @owned $TestArray2):
297+
(%2, %3) = destructure_tuple %0 : $(Builtin.NativeObject, Builtin.Int32)
298+
(%4, %5, %6) = destructure_struct %1 : $TestArray2
299+
%7 = tuple(%2 : $Builtin.NativeObject, %3 : $Builtin.Int32, %4 : $TestArrayStorage, %5 : $Builtin.Int32, %6 : $TestArrayStorage)
300+
return %7 : $(Builtin.NativeObject, Builtin.Int32, TestArrayStorage, Builtin.Int32, TestArrayStorage)
301+
}

0 commit comments

Comments
 (0)