Skip to content

Commit 23599f0

Browse files
committed
simplify_cfg.sil Strip unnecessary options and imports
1 parent 19007a6 commit 23599f0

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

test/SILOptimizer/simplify_cfg_ossa.sil

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
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
29

310
// Declare this SIL to be canonical because some tests break raw SIL
411
// conventions. e.g. address-type block args. -enforce-exclusivity=none is also
512
// required to allow address-type block args in canonical SIL.
613
sil_stage canonical
714

815
import Builtin
9-
import Swift
1016

1117
///////////////////////
1218
// Type Declarations //
@@ -41,6 +47,10 @@ struct FakeBool {
4147

4248
sil [ossa] @dummy : $@convention(thin) () -> FakeBool
4349

50+
struct NonTrivial {
51+
var object: AnyObject
52+
}
53+
4454
///////////
4555
// Tests //
4656
///////////
@@ -1695,24 +1705,24 @@ bb16:
16951705
br bb8(%65 : $TestEnm)
16961706
}
16971707

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
17001710

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) -> ()
17041714
cond_br %condition, bb1, bb2
17051715
bb1:
1706-
apply %print(%arg) : $@convention(thin) (@guaranteed String) -> ()
1716+
apply %print(%arg) : $@convention(thin) (@guaranteed NonTrivial) -> ()
17071717
br bb3
17081718
bb2:
17091719
br bb3
17101720
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
17131723
cond_br %condition, bb4, bb5
17141724
bb4:
1715-
apply %print(%yield) : $@convention(thin) (@guaranteed String) -> ()
1725+
apply %print(%yield) : $@convention(thin) (@guaranteed NonTrivial) -> ()
17161726
br bb6
17171727
bb5:
17181728
br bb6

0 commit comments

Comments
 (0)