rust/tests/codegen-llvm/issues/matches-logical-or-141497.rs
2026-02-04 19:20:10 +01:00

24 lines
552 B
Rust

// Tests that `matches!` optimizes the same as
// `f == FrameType::Inter || f == FrameType::Switch`.
//@ compile-flags: -Copt-level=3
//@ min-llvm-version: 23
#![crate_type = "lib"]
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum FrameType {
Key = 0,
Inter = 1,
Intra = 2,
Switch = 3,
}
// CHECK-LABEL: @is_inter_or_switch
#[no_mangle]
pub fn is_inter_or_switch(f: FrameType) -> bool {
// CHECK-NEXT: start:
// CHECK-NEXT: trunc i8 %{{.*}} to i1
// CHECK-NEXT: ret
matches!(f, FrameType::Inter | FrameType::Switch)
}