]>
Commit | Line | Data |
---|---|---|
6a06907d XL |
1 | // min-llvm-version: 12.0 |
2 | // compile-flags: -C opt-level=3 | |
3 | ||
4 | #![crate_type = "lib"] | |
5 | ||
6 | // Verify that we don't miscompile this even if rustc didn't apply the trivial loop detection to | |
7 | // insert the sideeffect intrinsic. | |
8 | ||
9 | fn infinite_loop() -> u8 { | |
10 | let mut x = 0; | |
11 | // CHECK-NOT: sideeffect | |
12 | loop { | |
13 | if x == 42 { | |
14 | x = 0; | |
15 | } else { | |
16 | x = 42; | |
17 | } | |
18 | } | |
19 | } | |
20 | ||
21 | // CHECK-LABEL: @test | |
22 | #[no_mangle] | |
23 | fn test() -> u8 { | |
24 | // CHECK-NOT: unreachable | |
25 | // CHECK: br label %{{.+}} | |
26 | // CHECK-NOT: unreachable | |
27 | let x = infinite_loop(); | |
28 | x | |
29 | } |