@@ -63,6 +63,57 @@ pub fn result_nop_traits_32(x: Result<i32, u32>) -> Result<i32, u32> {
63
63
try { x? }
64
64
}
65
65
66
+ // CHECK-LABEL: @control_flow_nop_match_32
67
+ #[ no_mangle]
68
+ pub fn control_flow_nop_match_32 ( x : ControlFlow < i32 , u32 > ) -> ControlFlow < i32 , u32 > {
69
+ // CHECK: start:
70
+ // CHECK-NEXT: insertvalue { i32, i32 }
71
+ // CHECK-NEXT: insertvalue { i32, i32 }
72
+ // CHECK-NEXT: ret { i32, i32 }
73
+ match x {
74
+ Continue ( x) => Continue ( x) ,
75
+ Break ( x) => Break ( x) ,
76
+ }
77
+ }
78
+
79
+ // CHECK-LABEL: @control_flow_nop_traits_32
80
+ #[ no_mangle]
81
+ pub fn control_flow_nop_traits_32 ( x : ControlFlow < i32 , u32 > ) -> ControlFlow < i32 , u32 > {
82
+ // CHECK: start:
83
+ // CHECK-NEXT: insertvalue { i32, i32 }
84
+ // CHECK-NEXT: insertvalue { i32, i32 }
85
+ // CHECK-NEXT: ret { i32, i32 }
86
+ try { x? }
87
+ }
88
+
89
+ // CHECK-LABEL: @option_nop_match_64
90
+ #[ no_mangle]
91
+ pub fn option_nop_match_64 ( x : Option < u64 > ) -> Option < u64 > {
92
+ // CHECK: start:
93
+ // TWENTY-NEXT: %[[TRUNC:[0-9]+]] = trunc nuw i64 %0 to i1
94
+ // TWENTY-NEXT: %[[SEL:\.[0-9]+]] = select i1 %[[TRUNC]], i64 %1, i64 undef
95
+ // CHECK-NEXT: [[REG1:%[0-9a-zA-Z_.]+]] = insertvalue { i64, i64 } poison, i64 %0, 0
96
+ // NINETEEN-NEXT: [[REG2:%[0-9a-zA-Z_.]+]] = insertvalue { i64, i64 } [[REG1]], i64 %1, 1
97
+ // TWENTY-NEXT: [[REG2:%[0-9a-zA-Z_.]+]] = insertvalue { i64, i64 } [[REG1]], i64 %[[SEL]], 1
98
+ // CHECK-NEXT: ret { i64, i64 } [[REG2]]
99
+ match x {
100
+ Some ( x) => Some ( x) ,
101
+ None => None ,
102
+ }
103
+ }
104
+
105
+ // CHECK-LABEL: @option_nop_traits_64
106
+ #[ no_mangle]
107
+ pub fn option_nop_traits_64 ( x : Option < u64 > ) -> Option < u64 > {
108
+ // CHECK: start:
109
+ // TWENTY-NEXT: %[[TRUNC:[0-9]+]] = trunc nuw i64 %0 to i1
110
+ // TWENTY-NEXT: %[[SEL:\.[0-9]+]] = select i1 %[[TRUNC]], i64 %1, i64 undef
111
+ // CHECK-NEXT: insertvalue { i64, i64 }
112
+ // CHECK-NEXT: insertvalue { i64, i64 }
113
+ // CHECK-NEXT: ret { i64, i64 }
114
+ try { x? }
115
+ }
116
+
66
117
// CHECK-LABEL: @result_nop_match_64
67
118
#[ no_mangle]
68
119
pub fn result_nop_match_64 ( x : Result < i64 , u64 > ) -> Result < i64 , u64 > {
@@ -86,48 +137,98 @@ pub fn result_nop_traits_64(x: Result<i64, u64>) -> Result<i64, u64> {
86
137
try { x? }
87
138
}
88
139
89
- // CHECK-LABEL: @result_nop_match_ptr
140
+ // CHECK-LABEL: @control_flow_nop_match_64
90
141
#[ no_mangle]
91
- pub fn result_nop_match_ptr ( x : Result < usize , Box < ( ) > > ) -> Result < usize , Box < ( ) > > {
142
+ pub fn control_flow_nop_match_64 ( x : ControlFlow < i64 , u64 > ) -> ControlFlow < i64 , u64 > {
92
143
// CHECK: start:
93
- // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
94
- // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
95
- // CHECK-NEXT: ret
144
+ // CHECK-NEXT: insertvalue { i64, i64 }
145
+ // CHECK-NEXT: insertvalue { i64, i64 }
146
+ // CHECK-NEXT: ret { i64, i64 }
147
+ match x {
148
+ Continue ( x) => Continue ( x) ,
149
+ Break ( x) => Break ( x) ,
150
+ }
151
+ }
152
+
153
+ // CHECK-LABEL: @control_flow_nop_traits_64
154
+ #[ no_mangle]
155
+ pub fn control_flow_nop_traits_64 ( x : ControlFlow < i64 , u64 > ) -> ControlFlow < i64 , u64 > {
156
+ // CHECK: start:
157
+ // CHECK-NEXT: insertvalue { i64, i64 }
158
+ // CHECK-NEXT: insertvalue { i64, i64 }
159
+ // CHECK-NEXT: ret { i64, i64 }
160
+ try { x? }
161
+ }
162
+
163
+ // CHECK-LABEL: @result_nop_match_128
164
+ #[ no_mangle]
165
+ pub fn result_nop_match_128 ( x : Result < i128 , u128 > ) -> Result < i128 , u128 > {
166
+ // CHECK: start:
167
+ // CHECK-NEXT: getelementptr inbounds {{(nuw )?}}i8
168
+ // CHECK-NEXT: store i128
169
+ // CHECK-NEXT: store i128
170
+ // CHECK-NEXT: ret void
96
171
match x {
97
172
Ok ( x) => Ok ( x) ,
98
173
Err ( x) => Err ( x) ,
99
174
}
100
175
}
101
176
102
- // CHECK-LABEL: @result_nop_traits_ptr
177
+ // CHECK-LABEL: @result_nop_traits_128
103
178
#[ no_mangle]
104
- pub fn result_nop_traits_ptr ( x : Result < u64 , NonNull < ( ) > > ) -> Result < u64 , NonNull < ( ) > > {
179
+ pub fn result_nop_traits_128 ( x : Result < i128 , u128 > ) -> Result < i128 , u128 > {
105
180
// CHECK: start:
106
- // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
107
- // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
108
- // CHECK-NEXT: ret
181
+ // CHECK-NEXT: getelementptr inbounds {{(nuw )?}}i8
182
+ // CHECK-NEXT: store i128
183
+ // CHECK-NEXT: store i128
184
+ // CHECK-NEXT: ret void
109
185
try { x? }
110
186
}
111
187
112
- // CHECK-LABEL: @control_flow_nop_match_32
188
+ // CHECK-LABEL: @control_flow_nop_match_128
113
189
#[ no_mangle]
114
- pub fn control_flow_nop_match_32 ( x : ControlFlow < i32 , u32 > ) -> ControlFlow < i32 , u32 > {
190
+ pub fn control_flow_nop_match_128 ( x : ControlFlow < i128 , u128 > ) -> ControlFlow < i128 , u128 > {
115
191
// CHECK: start:
116
- // CHECK-NEXT: insertvalue { i32, i32 }
117
- // CHECK-NEXT: insertvalue { i32, i32 }
118
- // CHECK-NEXT: ret { i32, i32 }
192
+ // CHECK-NEXT: getelementptr inbounds {{(nuw )?}}i8
193
+ // CHECK-NEXT: store i128
194
+ // CHECK-NEXT: store i128
195
+ // CHECK-NEXT: ret void
119
196
match x {
120
197
Continue ( x) => Continue ( x) ,
121
198
Break ( x) => Break ( x) ,
122
199
}
123
200
}
124
201
125
- // CHECK-LABEL: @control_flow_nop_traits_32
202
+ // CHECK-LABEL: @control_flow_nop_traits_128
126
203
#[ no_mangle]
127
- pub fn control_flow_nop_traits_32 ( x : ControlFlow < i32 , u32 > ) -> ControlFlow < i32 , u32 > {
204
+ pub fn control_flow_nop_traits_128 ( x : ControlFlow < i128 , u128 > ) -> ControlFlow < i128 , u128 > {
128
205
// CHECK: start:
129
- // CHECK-NEXT: insertvalue { i32, i32 }
130
- // CHECK-NEXT: insertvalue { i32, i32 }
131
- // CHECK-NEXT: ret { i32, i32 }
206
+ // CHECK-NEXT: getelementptr inbounds {{(nuw )?}}i8
207
+ // CHECK-NEXT: store i128
208
+ // CHECK-NEXT: store i128
209
+ // CHECK-NEXT: ret void
210
+ try { x? }
211
+ }
212
+
213
+ // CHECK-LABEL: @result_nop_match_ptr
214
+ #[ no_mangle]
215
+ pub fn result_nop_match_ptr ( x : Result < usize , Box < ( ) > > ) -> Result < usize , Box < ( ) > > {
216
+ // CHECK: start:
217
+ // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
218
+ // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
219
+ // CHECK-NEXT: ret
220
+ match x {
221
+ Ok ( x) => Ok ( x) ,
222
+ Err ( x) => Err ( x) ,
223
+ }
224
+ }
225
+
226
+ // CHECK-LABEL: @result_nop_traits_ptr
227
+ #[ no_mangle]
228
+ pub fn result_nop_traits_ptr ( x : Result < u64 , NonNull < ( ) > > ) -> Result < u64 , NonNull < ( ) > > {
229
+ // CHECK: start:
230
+ // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
231
+ // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
232
+ // CHECK-NEXT: ret
132
233
try { x? }
133
234
}
0 commit comments