blob: 4cc82414546b298c664be37db0e83a8b0fd9f0ca (
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
28
29
30
31
32
|
// compile-flags: -O
#![crate_type = "lib"]
// Test that LLVM can eliminate the unreachable `Variant::Zero` branch.
#[derive(Copy, Clone, Eq, PartialEq)]
pub enum Variant {
Zero,
One,
Two,
}
extern {
fn exf1();
fn exf2();
}
pub static mut GLOBAL: Variant = Variant::Zero;
// CHECK-LABEL: @issue_77812
#[no_mangle]
pub unsafe fn issue_77812() {
let g = GLOBAL;
if g != Variant::Zero {
match g {
Variant::One => exf1(),
Variant::Two => exf2(),
// CHECK-NOT: panic
Variant::Zero => panic!(),
}
}
}
|