Skip to content

Commit 928c57d

Browse files
committed
Add test case for #119014
1 parent a334848 commit 928c57d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//@ compile-flags: -O
2+
//@ min-llvm-version: 18
3+
4+
#![crate_type = "lib"]
5+
6+
pub enum Enum {
7+
A(u32),
8+
B(u32),
9+
C(u32),
10+
}
11+
12+
#[no_mangle]
13+
pub fn foo(lhs: &Enum, rhs: &Enum) -> bool {
14+
// CHECK-LABEL: define{{.*}}i1 @foo(
15+
// CHECK-NOT: switch
16+
// CHECK-NOT: br
17+
// CHECK: [[SELECT:%.*]] = select
18+
// CHECK-NEXT: ret i1 [[SELECT]]
19+
// CHECK-NEXT: }
20+
match (lhs, rhs) {
21+
(Enum::A(lhs), Enum::A(rhs)) => lhs == rhs,
22+
(Enum::B(lhs), Enum::B(rhs)) => lhs == rhs,
23+
(Enum::C(lhs), Enum::C(rhs)) => lhs == rhs,
24+
_ => false,
25+
}
26+
}

0 commit comments

Comments
 (0)