File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ // min-llvm-version: 15.0
2+ // compile-flags: -O -Z merge-functions=disabled --edition=2021
3+ // only-x86_64
4+
5+ #![ crate_type = "lib" ]
6+ #![ feature( try_blocks) ]
7+
8+ // These are now NOPs in LLVM 15, presumably thanks to nikic's change mentioned in
9+ // <https://github.com/rust-lang/rust/issues/85133#issuecomment-1072168354>.
10+ // Unfortunately, as of 2022-08-17 they're not yet nops for `u64`s nor `Option`.
11+
12+ use std:: ops:: ControlFlow :: { self , Continue , Break } ;
13+
14+ // CHECK-LABEL: @result_nop_match_32
15+ #[ no_mangle]
16+ pub fn result_nop_match_32 ( x : Result < i32 , u32 > ) -> Result < i32 , u32 > {
17+ // CHECK: start
18+ // CHECK-NEXT: ret i64 %0
19+ match x {
20+ Ok ( x) => Ok ( x) ,
21+ Err ( x) => Err ( x) ,
22+ }
23+ }
24+
25+ // CHECK-LABEL: @result_nop_traits_32
26+ #[ no_mangle]
27+ pub fn result_nop_traits_32 ( x : Result < i32 , u32 > ) -> Result < i32 , u32 > {
28+ // CHECK: start
29+ // CHECK-NEXT: ret i64 %0
30+ try {
31+ x?
32+ }
33+ }
34+
35+ // CHECK-LABEL: @control_flow_nop_match_32
36+ #[ no_mangle]
37+ pub fn control_flow_nop_match_32 ( x : ControlFlow < i32 , u32 > ) -> ControlFlow < i32 , u32 > {
38+ // CHECK: start
39+ // CHECK-NEXT: ret i64 %0
40+ match x {
41+ Continue ( x) => Continue ( x) ,
42+ Break ( x) => Break ( x) ,
43+ }
44+ }
45+
46+ // CHECK-LABEL: @control_flow_nop_traits_32
47+ #[ no_mangle]
48+ pub fn control_flow_nop_traits_32 ( x : ControlFlow < i32 , u32 > ) -> ControlFlow < i32 , u32 > {
49+ // CHECK: start
50+ // CHECK-NEXT: ret i64 %0
51+ try {
52+ x?
53+ }
54+ }
You can’t perform that action at this time.
0 commit comments