Skip to content

Commit c12c084

Browse files
dianqknikic
authored andcommitted
Cherry-pick test for issue rust-lang#114312
1 parent 62ca87f commit c12c084

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/codegen/issues/issue-114312.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// compile-flags: -O
2+
// min-llvm-version: 17
3+
// only-x86_64-unknown-linux-gnu
4+
5+
// We want to check that this function does not mis-optimize to loop jumping.
6+
7+
#![crate_type = "lib"]
8+
9+
#[repr(C)]
10+
pub enum Expr {
11+
Sum,
12+
// must have more than usize data
13+
Sub(usize, u8),
14+
}
15+
16+
#[no_mangle]
17+
pub extern "C" fn issue_114312(expr: Expr) {
18+
// CHECK-LABEL: @issue_114312(
19+
// CHECK-NOT: readonly
20+
// CHECK-SAME: byval
21+
// CHECK-NEXT: start:
22+
// CHECK-NEXT: ret void
23+
match expr {
24+
Expr::Sum => {}
25+
Expr::Sub(_, _) => issue_114312(Expr::Sum),
26+
}
27+
}

0 commit comments

Comments
 (0)