summaryrefslogtreecommitdiffstats
path: root/tests/codegen/issues/issue-114312.rs
blob: e2fbcef721ef38e626eab6eee4727373b9d884e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// compile-flags: -O
// min-llvm-version: 17
// only-x86_64-unknown-linux-gnu

// We want to check that this function does not mis-optimize to loop jumping.

#![crate_type = "lib"]

#[repr(C)]
pub enum Expr {
    Sum,
    // must have more than usize data
    Sub(usize, u8),
}

#[no_mangle]
pub extern "C" fn issue_114312(expr: Expr) {
    // CHECK-LABEL: @issue_114312(
    // CHECK-NOT: readonly
    // CHECK-SAME: byval
    // CHECK-NEXT: start:
    // CHECK-NEXT: ret void
    match expr {
        Expr::Sum => {}
        Expr::Sub(_, _) => issue_114312(Expr::Sum),
    }
}