|
1 |
| -// RUN: %target-sil-opt -enable-objc-interop -enforce-exclusivity=none -enable-sil-verify-all %s -jumpthread-simplify-cfg | %FileCheck %s |
| 1 | +// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | %FileCheck %s |
| 2 | + |
| 3 | +// Test miscellaneous SimplifyCFG optimization from simplifyBlocks. |
| 4 | +// |
| 5 | +// Does not include: |
| 6 | +// - tryJumpThreading. |
| 7 | +// - dominatorBasedSimplify |
| 8 | +// - CheckedCastBranchJumpThreading |
2 | 9 |
|
3 | 10 | // Declare this SIL to be canonical because some tests break raw SIL
|
4 | 11 | // conventions. e.g. address-type block args. -enforce-exclusivity=none is also
|
5 | 12 | // required to allow address-type block args in canonical SIL.
|
6 | 13 | sil_stage canonical
|
7 | 14 |
|
8 | 15 | import Builtin
|
9 |
| -import Swift |
10 | 16 |
|
11 | 17 | ///////////////////////
|
12 | 18 | // Type Declarations //
|
@@ -41,6 +47,10 @@ struct FakeBool {
|
41 | 47 |
|
42 | 48 | sil [ossa] @dummy : $@convention(thin) () -> FakeBool
|
43 | 49 |
|
| 50 | +struct NonTrivial { |
| 51 | + var object: AnyObject |
| 52 | +} |
| 53 | + |
44 | 54 | ///////////
|
45 | 55 | // Tests //
|
46 | 56 | ///////////
|
@@ -1695,24 +1705,24 @@ bb16:
|
1695 | 1705 | br bb8(%65 : $TestEnm)
|
1696 | 1706 | }
|
1697 | 1707 |
|
1698 |
| -sil [ossa] @print : $@convention(thin) (@guaranteed String) -> () |
1699 |
| -sil [ossa] @yield_string : $@yield_once @convention(thin) () -> @yields @guaranteed String |
| 1708 | +sil [ossa] @print : $@convention(thin) (@guaranteed NonTrivial) -> () |
| 1709 | +sil [ossa] @yield_string : $@yield_once @convention(thin) () -> @yields @guaranteed NonTrivial |
1700 | 1710 |
|
1701 |
| -sil [ossa] @dont_clone_begin_apply : $(Builtin.Int1, @guaranteed String) -> () { |
1702 |
| -bb0(%condition : $Builtin.Int1, %arg : @guaranteed $String): |
1703 |
| - %print = function_ref @print : $@convention(thin) (@guaranteed String) -> () |
| 1711 | +sil [ossa] @dont_clone_begin_apply : $(Builtin.Int1, @guaranteed NonTrivial) -> () { |
| 1712 | +bb0(%condition : $Builtin.Int1, %arg : @guaranteed $NonTrivial): |
| 1713 | + %print = function_ref @print : $@convention(thin) (@guaranteed NonTrivial) -> () |
1704 | 1714 | cond_br %condition, bb1, bb2
|
1705 | 1715 | bb1:
|
1706 |
| - apply %print(%arg) : $@convention(thin) (@guaranteed String) -> () |
| 1716 | + apply %print(%arg) : $@convention(thin) (@guaranteed NonTrivial) -> () |
1707 | 1717 | br bb3
|
1708 | 1718 | bb2:
|
1709 | 1719 | br bb3
|
1710 | 1720 | bb3:
|
1711 |
| - %yield_string = function_ref @yield_string : $@yield_once @convention(thin) () -> @yields @guaranteed String |
1712 |
| - (%yield, %token) = begin_apply %yield_string() : $@yield_once @convention(thin) () -> @yields @guaranteed String |
| 1721 | + %yield_string = function_ref @yield_string : $@yield_once @convention(thin) () -> @yields @guaranteed NonTrivial |
| 1722 | + (%yield, %token) = begin_apply %yield_string() : $@yield_once @convention(thin) () -> @yields @guaranteed NonTrivial |
1713 | 1723 | cond_br %condition, bb4, bb5
|
1714 | 1724 | bb4:
|
1715 |
| - apply %print(%yield) : $@convention(thin) (@guaranteed String) -> () |
| 1725 | + apply %print(%yield) : $@convention(thin) (@guaranteed NonTrivial) -> () |
1716 | 1726 | br bb6
|
1717 | 1727 | bb5:
|
1718 | 1728 | br bb6
|
|
0 commit comments