|
1 |
| -// RUN: %target-sil-opt -sil-print-types -enable-copy-propagation=requested-passes-only -enable-objc-interop -enforce-exclusivity=none -enable-sil-verify-all %s -update-borrowed-from -sil-combine | %FileCheck %s |
| 1 | +// RUN: %target-sil-opt -sil-print-types -enable-copy-propagation=requested-passes-only -enable-objc-interop -enforce-exclusivity=none -enable-sil-verify-all %s -update-borrowed-from -sil-combine -wmo | %FileCheck %s |
2 | 2 | // RUN: %target-sil-opt -sil-print-types -enable-copy-propagation=requested-passes-only -enable-objc-interop -enforce-exclusivity=none -enable-sil-verify-all %s -update-borrowed-from -sil-combine -generic-specializer | %FileCheck %s --check-prefix=CHECK_FORWARDING_OWNERSHIP_KIND
|
3 | 3 | //
|
4 | 4 | // FIXME: check copy-propagation output instead once it is the default mode
|
@@ -5447,3 +5447,54 @@ bb0(%0 : @owned $C):
|
5447 | 5447 | return %6 : $()
|
5448 | 5448 | }
|
5449 | 5449 |
|
| 5450 | +private protocol Pr: AnyObject { |
| 5451 | +} |
| 5452 | + |
| 5453 | +private class Cr: Pr { |
| 5454 | +} |
| 5455 | + |
| 5456 | +sil @use_pr : $@convention(thin) <τ_0_0 where τ_0_0 : Pr> (@in τ_0_0) -> () |
| 5457 | + |
| 5458 | +// CHECK-LABEL: sil [ossa] @existential_consumed_too_early1 : |
| 5459 | +// CHECK: apply {{.*}}<@opened |
| 5460 | +// CHECK: } // end sil function 'existential_consumed_too_early1' |
| 5461 | +sil [ossa] @existential_consumed_too_early1 : $@convention(thin) (@owned Pr) -> () { |
| 5462 | +bb0(%0 : @owned $Pr): |
| 5463 | + %2 = open_existential_ref %0 to $@opened("5554ACAA-0F2B-11F0-86AA-0EA13E3AABB1", any Pr) Self |
| 5464 | + %3 = alloc_stack $@opened("5554ACAA-0F2B-11F0-86AA-0EA13E3AABB1", any Pr) Self |
| 5465 | + store %2 to [init] %3 |
| 5466 | + %5 = function_ref @use_pr : $@convention(thin) <τ_0_0 where τ_0_0 : Pr> (@in τ_0_0) -> () |
| 5467 | + %6 = apply %5<@opened("5554ACAA-0F2B-11F0-86AA-0EA13E3AABB1", any Pr) Self>(%3) : $@convention(thin) <τ_0_0 where τ_0_0 : Pr> (@in τ_0_0) -> () |
| 5468 | + dealloc_stack %3 |
| 5469 | + %8 = tuple () |
| 5470 | + return %8 |
| 5471 | +} |
| 5472 | + |
| 5473 | +// CHECK-LABEL: sil [ossa] @existential_consumed_too_early2 : |
| 5474 | +// CHECK: apply {{.*}}<@opened |
| 5475 | +// CHECK: } // end sil function 'existential_consumed_too_early2' |
| 5476 | +sil [ossa] @existential_consumed_too_early2 : $@convention(thin) (@owned Cr) -> () { |
| 5477 | +bb0(%0 : @owned $Cr): |
| 5478 | + %1 = init_existential_ref %0 : $Cr : $Cr, $any Pr |
| 5479 | + %2 = open_existential_ref %1 to $@opened("5554ACAA-0F2B-11F0-86AA-0EA13E3AABB1", any Pr) Self |
| 5480 | + %3 = alloc_stack $@opened("5554ACAA-0F2B-11F0-86AA-0EA13E3AABB1", any Pr) Self |
| 5481 | + store %2 to [init] %3 |
| 5482 | + %5 = function_ref @use_pr : $@convention(thin) <τ_0_0 where τ_0_0 : Pr> (@in τ_0_0) -> () |
| 5483 | + %6 = apply %5<@opened("5554ACAA-0F2B-11F0-86AA-0EA13E3AABB1", any Pr) Self>(%3) : $@convention(thin) <τ_0_0 where τ_0_0 : Pr> (@in τ_0_0) -> () |
| 5484 | + dealloc_stack %3 |
| 5485 | + %8 = tuple () |
| 5486 | + return %8 |
| 5487 | +} |
| 5488 | + |
| 5489 | +// CHECK-LABEL: sil [ossa] @init_existential_with_debug_value : |
| 5490 | +// CHECK: return %0 |
| 5491 | +// CHECK: } // end sil function 'init_existential_with_debug_value' |
| 5492 | +sil [ossa] @init_existential_with_debug_value : $@convention(thin) (@owned Cr) -> @owned Cr { |
| 5493 | +bb0(%1 : @owned $Cr): |
| 5494 | + %5 = init_existential_ref %1 : $Cr : $Cr, $any Pr |
| 5495 | + debug_value %5, let, name "interactor", argno 2 |
| 5496 | + %48 = open_existential_ref %5 to $@opened("F9D78C78-0FCD-11F0-9F91-0EA13E3AABB1", any Pr) Self |
| 5497 | + %49 = unchecked_ref_cast %48 to $Cr |
| 5498 | + return %49 |
| 5499 | +} |
| 5500 | + |
0 commit comments