add codegen test for #110797
This commit is contained in:
parent
15d07fb2cb
commit
ddb94dbd16
27
tests/codegen/issues/issue-110797-enum-jump-same.rs
Normal file
27
tests/codegen/issues/issue-110797-enum-jump-same.rs
Normal file
@ -0,0 +1,27 @@
|
||||
//@ compile-flags: -O
|
||||
// XXX: The x86-64 assembly get optimized correclty. But llvm-ir output is not until llvm 18?
|
||||
//@ min-llvm-version: 18
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub enum K{
|
||||
A(Box<[i32]>),
|
||||
B(Box<[u8]>),
|
||||
C(Box<[String]>),
|
||||
D(Box<[u16]>),
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
// CHECK-LABEL: @get_len
|
||||
// CHECK: getelementptr inbounds
|
||||
// CHECK-NEXT: load
|
||||
// CHECK-NEXT: ret i64
|
||||
// CHECK-NOT: switch
|
||||
pub fn get_len(arg: &K)->usize{
|
||||
match arg {
|
||||
K::A(ref lst)=>lst.len(),
|
||||
K::B(ref lst)=>lst.len(),
|
||||
K::C(ref lst)=>lst.len(),
|
||||
K::D(ref lst)=>lst.len(),
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user