File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ static bool isConsumed(
8989 })) {
9090 forwardingInsts.get ()->push_back (user);
9191 for (SILValue v : user->getResults ()) {
92+ if (v.getOwnershipKind () != ValueOwnershipKind::Owned)
93+ continue ;
9294 copy (v->getUses (), std::back_inserter (worklist));
9395 }
9496 continue ;
Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ struct NativeObjectPair {
1818
1919class Klass {}
2020
21+ struct MyInt {
22+ var value: Builtin.Int32
23+ }
24+
2125struct AnotherStruct {
2226 var i : Builtin.Int32
2327 var c : Klass
@@ -378,3 +382,16 @@ bb3:
378382 %9999 = tuple()
379383 return %9999 : $()
380384}
385+
386+ // CHECK-LABEL: sil [ossa] @do_not_add_trivial_users_of_owned_values_to_isconsumed_worklist : $@convention(thin) (@guaranteed (Klass, MyInt)) -> Builtin.Int32 {
387+ // CHECK-NOT: copy_value
388+ // CHECK-NOT: destroy_value
389+ // CHECK: } // end sil function 'do_not_add_trivial_users_of_owned_values_to_isconsumed_worklist'
390+ sil [ossa] @do_not_add_trivial_users_of_owned_values_to_isconsumed_worklist : $@convention(thin) (@guaranteed (Klass, MyInt)) -> Builtin.Int32 {
391+ bb0(%0 : @guaranteed $(Klass, MyInt)):
392+ %1 = copy_value %0 : $(Klass, MyInt)
393+ (%2, %3) = destructure_tuple %1 : $(Klass, MyInt)
394+ %4 = struct_extract %3 : $MyInt, #MyInt.value
395+ destroy_value %2 : $Klass
396+ return %4 : $Builtin.Int32
397+ }
You can’t perform that action at this time.
0 commit comments