@@ -63,6 +63,57 @@ pub fn result_nop_traits_32(x: Result<i32, u32>) -> Result<i32, u32> {
6363 try { x? }
6464}
6565
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 = trunc nuw i64 %0 to i1
94+ // TWENTY-NEXT: %.2 = select i1 %trunc, i64 %1, i64 undef
95+ // CHECK-NEXT: [[REG1:%.*]] = insertvalue { i64, i64 } poison, i64 %0, 0
96+ // NINETEEN-NEXT: [[REG2:%.*]] = insertvalue { i64, i64 } [[REG1]], i64 %1, 1
97+ // TWENTY-NEXT: [[REG2:%.*]] = insertvalue { i64, i64 } [[REG1]], i64 %.2, 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 = trunc nuw i64 %0 to i1
110+ // TWENTY-NEXT: %.1 = 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+
66117// CHECK-LABEL: @result_nop_match_64
67118#[ no_mangle]
68119pub fn result_nop_match_64 ( x : Result < i64 , u64 > ) -> Result < i64 , u64 > {
@@ -86,48 +137,133 @@ pub fn result_nop_traits_64(x: Result<i64, u64>) -> Result<i64, u64> {
86137 try { x? }
87138}
88139
89- // CHECK-LABEL: @result_nop_match_ptr
140+ // CHECK-LABEL: @control_flow_nop_match_64
90141#[ 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 > {
92143 // 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
96171 match x {
97172 Ok ( x) => Ok ( x) ,
98173 Err ( x) => Err ( x) ,
99174 }
100175}
101176
102- // CHECK-LABEL: @result_nop_traits_ptr
177+ // CHECK-LABEL: @result_nop_traits_128
103178#[ 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 > {
105180 // 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
109185 try { x? }
110186}
111187
112- // CHECK-LABEL: @control_flow_nop_match_32
188+ // CHECK-LABEL: @control_flow_nop_match_128
113189#[ 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 > {
115191 // 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
119196 match x {
120197 Continue ( x) => Continue ( x) ,
121198 Break ( x) => Break ( x) ,
122199 }
123200}
124201
125- // CHECK-LABEL: @control_flow_nop_traits_32
202+ // CHECK-LABEL: @control_flow_nop_traits_128
126203#[ 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 > {
128205 // 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: @option_nop_match_128
214+ #[ no_mangle]
215+ pub fn option_nop_match_128 ( x : Option < i128 > ) -> Option < i128 > {
216+ // CHECK: start:
217+ // CHECK-NEXT: %trunc = trunc nuw i128 %0 to i1
218+ // CHECK-NEXT: br i1 %trunc, label %bb3, label %bb4
219+ // CHECK: bb3:
220+ // CHECK-NEXT: %2 = getelementptr inbounds {{(nuw )?}}i8, ptr %_0, i64 16
221+ // CHECK-NEXT: store i128 %1, ptr %2, align 16
222+ // CHECK: bb4:
223+ // CHECK-NEXT: %storemerge = phi i128 [ 1, %bb3 ], [ 0, %start ]
224+ // CHECK-NEXT: store i128 %storemerge, ptr %_0, align 16
225+ // CHECK-NEXT: ret void
226+ match x {
227+ Some ( x) => Some ( x) ,
228+ None => None ,
229+ }
230+ }
231+
232+ // CHECK-LABEL: @option_nop_traits_128
233+ #[ no_mangle]
234+ pub fn option_nop_traits_128 ( x : Option < i128 > ) -> Option < i128 > {
235+ // CHECK: start:
236+ // CHECK-NEXT: %trunc = trunc nuw i128 %0 to i1
237+ // CHECK-NEXT: br i1 %trunc, label %bb4, label %bb2
238+ // CHECK: bb4:
239+ // CHECK-NEXT: %2 = getelementptr inbounds {{(nuw )?}}i8, ptr %_0, i64 16
240+ // CHECK-NEXT: store i128 %1, ptr %2, align 16
241+ // CHECK: bb2:
242+ // CHECK-NEXT: %storemerge = phi i128 [ 1, %bb4 ], [ 0, %start ]
243+ // CHECK-NEXT: store i128 %storemerge, ptr %_0, align 16
244+ // CHECK-NEXT: ret void
245+ try { x? }
246+ }
247+
248+ // CHECK-LABEL: @result_nop_match_ptr
249+ #[ no_mangle]
250+ pub fn result_nop_match_ptr ( x : Result < usize , Box < ( ) > > ) -> Result < usize , Box < ( ) > > {
251+ // CHECK: start:
252+ // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
253+ // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
254+ // CHECK-NEXT: ret
255+ match x {
256+ Ok ( x) => Ok ( x) ,
257+ Err ( x) => Err ( x) ,
258+ }
259+ }
260+
261+ // CHECK-LABEL: @result_nop_traits_ptr
262+ #[ no_mangle]
263+ pub fn result_nop_traits_ptr ( x : Result < u64 , NonNull < ( ) > > ) -> Result < u64 , NonNull < ( ) > > {
264+ // CHECK: start:
265+ // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
266+ // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr }
267+ // CHECK-NEXT: ret
132268 try { x? }
133269}
0 commit comments