1
- // RUN: %target-swift-frontend -module-name OptimizationOptions -Onone -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=DEBUG
2
- // RUN: %target-swift-frontend -module-name OptimizationOptions -O -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=RELEASE
3
- // RUN: %target-swift-frontend -module-name OptimizationOptions -Ounchecked -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=UNCHECKED
4
- // RUN: %target-swift-frontend -module-name OptimizationOptions -Oplayground -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=PLAYGROUND
1
+ // RUN: %target-swift-frontend -module-name OptimizationOptions -Onone -emit-sil -primary-file %s -o - | %FileCheck %s --check-prefix=DEBUG
2
+ // RUN: %target-swift-frontend -module-name OptimizationOptions -O -emit-sil -primary-file %s -o - | %FileCheck %s --check-prefix=RELEASE
3
+ // RUN: %target-swift-frontend -module-name OptimizationOptions -Ounchecked -emit-sil -primary-file %s -o - | %FileCheck %s --check-prefix=UNCHECKED
4
+ // RUN: %target-swift-frontend -module-name OptimizationOptions -Oplayground -emit-sil -primary-file %s -o - | %FileCheck %s --check-prefix=PLAYGROUND
5
5
6
6
// REQUIRES: optimized_stdlib
7
7
// REQUIRES: swift_stdlib_asserts
8
- // REQUIRES: swift_stdlib_no_asserts
9
8
10
- func test_assert( ) ( x: Int , y: Int ) -> Int {
9
+ func test_assert( x: Int , y: Int ) -> Int {
11
10
assert ( x >= y , " x smaller than y " )
12
11
return x + y
13
12
}
@@ -30,85 +29,87 @@ func test_partial_safety_check(x: Int, y: Int) -> Int {
30
29
}
31
30
32
31
// In debug mode keep user asserts and runtime checks.
33
- // DEBUG-LABEL: _TF19OptimizationOptions11test_assertfT_FT1xSi1ySi_Si
34
- // DEBUG: "x smaller than y"
35
- // DEBUG: "assertion failed"
36
- // DEBUG: cond_fail
32
+ // DEBUG-LABEL: sil hidden @_TF19OptimizationOptions11test_assertFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
33
+ // DEBUG-DAG: string_literal utf8 "x smaller than y"
34
+ // DEBUG-DAG: string_literal utf8 "assertion failed"
35
+ // DEBUG-DAG: cond_fail
36
+ // DEBUG: return
37
37
38
38
// In playground mode keep user asserts and runtime checks.
39
- // PLAYGROUND-LABEL: _TF19OptimizationOptions11test_assertfT_FT1xSi1ySi_Si
40
- // PLAYGROUND: "x smaller than y"
41
- // PLAYGROUND: "assertion failed"
42
- // PLAYGROUND: cond_fail
39
+ // PLAYGROUND-LABEL: sil hidden @_TF19OptimizationOptions11test_assertFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
40
+ // PLAYGROUND-DAG: "assertion failed"
41
+ // PLAYGROUND-DAG: "x smaller than y"
42
+ // PLAYGROUND-DAG: cond_fail
43
+ // PLAYGROUND: return
43
44
44
45
// In release mode remove user asserts and keep runtime checks.
45
- // RELEASE-LABEL: _TF19OptimizationOptions11test_assertfT_FT1xSi1ySi_Si
46
+ // RELEASE-LABEL: sil hidden @_TF19OptimizationOptions11test_assertFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
46
47
// RELEASE-NOT: "x smaller than y"
47
48
// RELEASE-NOT: "assertion failed"
48
49
// RELEASE: cond_fail
50
+ // RELEASE: return
49
51
50
52
// In fast mode remove user asserts and runtime checks.
51
- // FAST-LABEL: _TF19OptimizationOptions11test_assertfT_FT1xSi1ySi_Si
53
+ // FAST-LABEL: sil hidden @_TF19OptimizationOptions11test_assertFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
52
54
// FAST-NOT: "x smaller than y"
53
55
// FAST-NOT: "assertion failed"
54
56
// FAST-NOT: cond_fail
55
57
56
58
57
59
// In debug mode keep verbose fatal errors.
58
- // DEBUG-LABEL: _TF19OptimizationOptions10test_fatalFTSiSi_Si
60
+ // DEBUG-LABEL: sil hidden @_TF19OptimizationOptions10test_fatalFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
59
61
// DEBUG-DAG: "Human nature ..."
60
- // DEBUG-DAG: %[[FATAL_ERROR:.+]] = function_ref @_TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su_T_
62
+ // DEBUG-DAG: %[[FATAL_ERROR:.+]] = function_ref @[[FATAL_ERROR_FUNC:.*fatalErrorMessage.*]] : $@convention(thin)
61
63
// DEBUG: apply %[[FATAL_ERROR]]{{.*}}
62
64
// DEBUG: unreachable
63
65
64
66
// In playground mode keep verbose fatal errors.
65
- // PLAYGROUND-LABEL: _TF19OptimizationOptions10test_fatalFTSiSi_Si
67
+ // PLAYGROUND-LABEL: sil hidden @_TF19OptimizationOptions10test_fatalFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
66
68
// PLAYGROUND-DAG: "Human nature ..."
67
- // PLAYGROUND-DAG: %[[FATAL_ERROR:.+]] = function_ref @_TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su_T_
69
+ // PLAYGROUND-DAG: %[[FATAL_ERROR:.+]] = function_ref @[[FATAL_ERROR_FUNC:.*fatalErrorMessage.*]] : $@convention(thin)
68
70
// PLAYGROUND: apply %[[FATAL_ERROR]]{{.*}}
69
71
// PLAYGROUND: unreachable
70
72
71
73
// In release mode keep succinct fatal errors (trap).
72
- // RELEASE-LABEL: _TF19OptimizationOptions10test_fatalFTSiSi_Si
74
+ // RELEASE-LABEL: sil hidden @_TF19OptimizationOptions10test_fatalFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
73
75
// RELEASE-NOT: "Human nature ..."
74
76
// RELEASE-NOT: "fatal error"
75
- // RELEASE: bb2:
76
- // RELEASE: %[[ALWAYS:.+]] = integer_literal $Builtin.Int1, -1
77
- // RELEASE: cond_fail %[[ALWAYS]]
77
+ // RELEASE: cond_fail
78
+ // RELEASE: return
78
79
79
80
// In fast mode remove fatal errors.
80
- // FAST-LABEL: _TF19OptimizationOptions10test_fatalFTSiSi_Si
81
+ // FAST-LABEL: sil hidden @_TF19OptimizationOptions10test_fatalFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
81
82
// FAST-NOT: "Human nature ..."
82
83
// FAST-NOT: "fatal error"
83
84
// FAST-NOT: int_trap
84
85
85
86
// Precondition safety checks.
86
87
87
88
// In debug mode keep verbose library precondition checks.
88
- // DEBUG-LABEL: _TF19OptimizationOptions23test_precondition_checkFTSiSi_Si
89
+ // DEBUG-LABEL: sil hidden @_TF19OptimizationOptions23test_precondition_checkFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
89
90
// DEBUG-DAG: "fatal error"
90
- // DEBUG-DAG: %[[FATAL_ERROR:.+]] = function_ref @_TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su_T_
91
+ // DEBUG-DAG: %[[FATAL_ERROR:.+]] = function_ref @[[FATAL_ERROR_FUNC]]
91
92
// DEBUG: apply %[[FATAL_ERROR]]{{.*}}
92
93
// DEBUG: unreachable
93
94
// DEBUG: return
94
95
95
96
// In playground mode keep verbose library precondition checks.
96
- // PLAYGROUND-LABEL: _TF19OptimizationOptions23test_precondition_checkFTSiSi_Si
97
+ // PLAYGROUND-LABEL: sil hidden @_TF19OptimizationOptions23test_precondition_checkFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
97
98
// PLAYGROUND-DAG: "fatal error"
98
- // PLAYGROUND-DAG: %[[FATAL_ERROR:.+]] = function_ref @_TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su_T_
99
+ // PLAYGROUND-DAG: %[[FATAL_ERROR:.+]] = function_ref @[[FATAL_ERROR_FUNC]]
99
100
// PLAYGROUND: apply %[[FATAL_ERROR]]{{.*}}
100
101
// PLAYGROUND: unreachable
101
102
// PLAYGROUND: return
102
103
103
104
// In release mode keep succinct library precondition checks (trap).
104
- // RELEASE-LABEL: _TF19OptimizationOptions23test_precondition_checkFTSiSi_Si
105
+ // RELEASE-LABEL: sil hidden @_TF19OptimizationOptions23test_precondition_checkFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
105
106
// RELEASE-NOT: "fatal error"
106
107
// RELEASE: %[[V2:.+]] = builtin "xor_Int1"(%{{.+}}, %{{.+}})
107
108
// RELEASE: cond_fail %[[V2]]
108
109
// RELEASE: return
109
110
110
111
// In unchecked mode remove library precondition checks.
111
- // UNCHECKED-LABEL: _TF19OptimizationOptions23test_precondition_checkFTSiSi_Si
112
+ // UNCHECKED-LABEL: sil hidden @_TF19OptimizationOptions23test_precondition_checkFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
112
113
// UNCHECKED-NOT: "fatal error"
113
114
// UNCHECKED-NOT: builtin "int_trap"
114
115
// UNCHECKED-NOT: unreachable
@@ -117,28 +118,28 @@ func test_partial_safety_check(x: Int, y: Int) -> Int {
117
118
// Partial safety checks.
118
119
119
120
// In debug mode keep verbose partial safety checks.
120
- // DEBUG-LABEL: _TF19OptimizationOptions25test_partial_safety_checkFTSiSi_Si
121
+ // DEBUG-LABEL: sil hidden @_TF19OptimizationOptions25test_partial_safety_checkFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
121
122
// DEBUG-DAG: "fatal error"
122
- // DEBUG-DAG: %[[FATAL_ERROR:.+]] = function_ref @_TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su_T_
123
+ // DEBUG-DAG: %[[FATAL_ERROR:.+]] = function_ref @[[FATAL_ERROR_FUNC]]
123
124
// DEBUG: apply %[[FATAL_ERROR]]{{.*}}
124
125
// DEBUG: unreachable
125
126
126
127
// In playground mode keep verbose partial safety checks.
127
- // PLAYGROUND-LABEL: _TF19OptimizationOptions25test_partial_safety_checkFTSiSi_Si
128
+ // PLAYGROUND-LABEL: sil hidden @_TF19OptimizationOptions25test_partial_safety_checkFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
128
129
// PLAYGROUND-DAG: "fatal error"
129
- // PLAYGROUND-DAG: %[[FATAL_ERROR:.+]] = function_ref @_TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su_T_
130
+ // PLAYGROUND-DAG: %[[FATAL_ERROR:.+]] = function_ref @[[FATAL_ERROR_FUNC]]
130
131
// PLAYGROUND: apply %[[FATAL_ERROR]]{{.*}}
131
132
// PLAYGROUND: unreachable
132
133
133
134
// In release mode remove partial safety checks.
134
- // RELEASE-LABEL: _TF19OptimizationOptions25test_partial_safety_checkFTSiSi_Si
135
+ // RELEASE-LABEL: sil hidden @_TF19OptimizationOptions25test_partial_safety_checkFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
135
136
// RELEASE-NOT: "fatal error"
136
137
// RELEASE-NOT: builtin "int_trap"
137
138
// RELEASE-NOT: unreachable
138
139
// RELEASE: return
139
140
140
141
// In fast mode remove partial safety checks.
141
- // FAST-LABEL: _TF19OptimizationOptions25test_partial_safety_checkFTSiSi_Si
142
+ // FAST-LABEL: sil hidden @_TF19OptimizationOptions25test_partial_safety_checkFT1xSi1ySi_Si : $@convention(thin) (Int, Int) -> Int {
142
143
// FAST-NOT: "fatal error"
143
144
// FAST-NOT: builtin "int_trap"
144
145
// FAST-NOT: unreachable
0 commit comments