summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/dead-store-elimination/cycle.rs
diff options
context:
space:
mode:
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 570bfe84d..c9ad06a9d 100644
--- a/tests/mir-opt/dead-store-elimination/cycle.rs
+++ b/tests/mir-opt/dead-store-elimination/cycle.rs
@@ -1,21 +1,41 @@
-// ignore-wasm32 compiled with panic=abort by default
+// 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, UnwindContinue())
+ }
+ bb1 = {
+ match condition { true => bb2, _ => ret }
+ }
+ bb2 = {
+ let temp = z;
+ z = y;
+ y = x;
+ x = temp;
+ Call(condition = cond(), bb1, UnwindContinue())
+ }
+ ret = {
+ Return()
+ }
+ )
}
fn main() {