rust/tests/mir-opt/dead-store-elimination/cycle.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
517 B
Rust
Raw Normal View History

2023-04-05 03:44:20 -05:00
// ignore-wasm32 compiled with panic=abort by default
2022-05-09 19:12:03 -05:00
// unit-test: DeadStoreElimination
#[inline(never)]
fn cond() -> bool {
false
}
// EMIT_MIR cycle.cycle.DeadStoreElimination.diff
fn cycle(mut x: i32, mut y: i32, mut z: i32) {
// This example is interesting because the non-transitive version of `MaybeLiveLocals` would
// report that *all* of these stores are live.
while cond() {
let temp = z;
z = y;
y = x;
x = temp;
}
}
fn main() {
cycle(1, 2, 3);
}