diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/mir-opt/dead-store-elimination/cycle.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/mir-opt/dead-store-elimination/cycle.rs')
-rw-r--r-- | tests/mir-opt/dead-store-elimination/cycle.rs | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/tests/mir-opt/dead-store-elimination/cycle.rs b/tests/mir-opt/dead-store-elimination/cycle.rs index cd34fe96e..8896f5ff3 100644 --- a/tests/mir-opt/dead-store-elimination/cycle.rs +++ b/tests/mir-opt/dead-store-elimination/cycle.rs @@ -1,21 +1,41 @@ -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// skip-filecheck +// This example is interesting because the non-transitive version of `MaybeLiveLocals` would +// report that *all* of these stores are live. +// +// needs-unwind // unit-test: DeadStoreElimination +#![feature(core_intrinsics, custom_mir)] +use std::intrinsics::mir::*; + #[inline(never)] fn cond() -> bool { false } // EMIT_MIR cycle.cycle.DeadStoreElimination.diff +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] 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; - } + // We use custom MIR to avoid generating debuginfo, that would force to preserve writes. + mir!( + let condition: bool; + { + Call(condition = cond(), bb1) + } + bb1 = { + match condition { true => bb2, _ => ret } + } + bb2 = { + let temp = z; + z = y; + y = x; + x = temp; + Call(condition = cond(), bb1) + } + ret = { + Return() + } + ) } fn main() { |