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