summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/dead-store-elimination/cycle.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:42 +0000
commitcec1877e180393eba0f6ddb0cf97bf3a791631c7 (patch)
tree47b4dac2a9dd9a40c30c251b4d4a72d7ccf77e9f /tests/mir-opt/dead-store-elimination/cycle.rs
parentAdding debian version 1.74.1+dfsg1-1. (diff)
downloadrustc-cec1877e180393eba0f6ddb0cf97bf3a791631c7.tar.xz
rustc-cec1877e180393eba0f6ddb0cf97bf3a791631c7.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.rs38
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() {