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(
89
89
})) {
90
90
forwardingInsts.get ()->push_back (user);
91
91
for (SILValue v : user->getResults ()) {
92
+ if (v.getOwnershipKind () != ValueOwnershipKind::Owned)
93
+ continue ;
92
94
copy (v->getUses (), std::back_inserter (worklist));
93
95
}
94
96
continue ;
Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ struct NativeObjectPair {
18
18
19
19
class Klass {}
20
20
21
+ struct MyInt {
22
+ var value: Builtin.Int32
23
+ }
24
+
21
25
struct AnotherStruct {
22
26
var i : Builtin.Int32
23
27
var c : Klass
@@ -378,3 +382,16 @@ bb3:
378
382
%9999 = tuple()
379
383
return %9999 : $()
380
384
}
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