We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a334848 commit 928c57dCopy full SHA for 928c57d
tests/codegen/enum/enum-early-otherwise-branch.rs
@@ -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