Skip to content

Commit

Permalink
Cherry-pick test for issue rust-lang#114312
Browse files Browse the repository at this point in the history
  • Loading branch information
DianQK authored and nikic committed Aug 15, 2023
1 parent 62ca87f commit c12c084
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/codegen/issues/issue-114312.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,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),
}
}

0 comments on commit c12c084

Please sign in to comment.