File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ // compile-flags: -O
2+ // ignore-debug (the extra assertions get in the way)
3+
4+ #![ crate_type = "lib" ]
5+
6+ // Adapted from <https://github.com/rust-lang/rust/issues/73258#issue-637346014>
7+
8+ #[ derive( Clone , Copy ) ]
9+ #[ repr( u8 ) ]
10+ pub enum Foo {
11+ A , B , C , D ,
12+ }
13+
14+ // CHECK-LABEL: @issue_73258(
15+ #[ no_mangle]
16+ pub unsafe fn issue_73258 ( ptr : * const Foo ) -> Foo {
17+ // CHECK-NOT: icmp
18+ // CHECK-NOT: call
19+ // CHECK-NOT: br
20+ // CHECK-NOT: select
21+
22+ // CHECK: %[[R:.+]] = load i8
23+ // CHECK-SAME: !range !
24+
25+ // CHECK-NOT: icmp
26+ // CHECK-NOT: call
27+ // CHECK-NOT: br
28+ // CHECK-NOT: select
29+
30+ // CHECK: ret i8 %[[R]]
31+
32+ // CHECK-NOT: icmp
33+ // CHECK-NOT: call
34+ // CHECK-NOT: br
35+ // CHECK-NOT: select
36+ let k: Option < Foo > = Some ( ptr. read ( ) ) ;
37+ return k. unwrap ( ) ;
38+ }
You can’t perform that action at this time.
0 commit comments