]> git.proxmox.com Git - rustc.git/blob - tests/mir-opt/dead-store-elimination/cycle.rs
b35ce0bcb5ad1de071ec29bca04d8a649371afe5
[rustc.git] / tests / mir-opt / dead-store-elimination / cycle.rs
1 // unit-test: DeadStoreElimination
2
3 #[inline(never)]
4 fn cond() -> bool {
5 false
6 }
7
8 // EMIT_MIR cycle.cycle.DeadStoreElimination.diff
9 fn cycle(mut x: i32, mut y: i32, mut z: i32) {
10 // This example is interesting because the non-transitive version of `MaybeLiveLocals` would
11 // report that *all* of these stores are live.
12 while cond() {
13 let temp = z;
14 z = y;
15 y = x;
16 x = temp;
17 }
18 }
19
20 fn main() {
21 cycle(1, 2, 3);
22 }