summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/dead-store-elimination
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt/dead-store-elimination')
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff76
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff73
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff73
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.rs2
-rw-r--r--tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff22
-rw-r--r--tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff44
-rw-r--r--tests/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff10
7 files changed, 182 insertions, 118 deletions
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff
deleted file mode 100644
index 2776ff51d..000000000
--- a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff
+++ /dev/null
@@ -1,76 +0,0 @@
-- // MIR for `cycle` before DeadStoreElimination
-+ // MIR for `cycle` after DeadStoreElimination
-
- fn cycle(_1: i32, _2: i32, _3: i32) -> () {
- debug x => _1; // in scope 0 at $DIR/cycle.rs:+0:10: +0:15
- debug y => _2; // in scope 0 at $DIR/cycle.rs:+0:22: +0:27
- debug z => _3; // in scope 0 at $DIR/cycle.rs:+0:34: +0:39
- let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:46: +0:46
-- let mut _4: (); // in scope 0 at $DIR/cycle.rs:+0:1: +9:2
-- let mut _5: bool; // in scope 0 at $DIR/cycle.rs:+3:11: +3:17
-- let _6: i32; // in scope 0 at $DIR/cycle.rs:+4:13: +4:17
-- let mut _7: i32; // in scope 0 at $DIR/cycle.rs:+5:13: +5:14
-- let mut _8: i32; // in scope 0 at $DIR/cycle.rs:+6:13: +6:14
-- let mut _9: i32; // in scope 0 at $DIR/cycle.rs:+7:13: +7:17
-- let mut _10: !; // in scope 0 at $DIR/cycle.rs:+3:5: +8:6
-- let _11: (); // in scope 0 at $DIR/cycle.rs:+3:5: +8:6
-- let mut _12: !; // in scope 0 at $DIR/cycle.rs:+3:5: +8:6
-+ let mut _4: bool; // in scope 0 at $DIR/cycle.rs:+3:11: +3:17
-+ let _5: i32; // in scope 0 at $DIR/cycle.rs:+4:13: +4:17
- scope 1 {
-- debug temp => _6; // in scope 1 at $DIR/cycle.rs:+4:13: +4:17
-+ debug temp => _5; // in scope 1 at $DIR/cycle.rs:+4:13: +4:17
- }
-
- bb0: {
- goto -> bb1; // scope 0 at $DIR/cycle.rs:+3:5: +8:6
- }
-
- bb1: {
-- StorageLive(_5); // scope 0 at $DIR/cycle.rs:+3:11: +3:17
-- _5 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
-+ StorageLive(_4); // scope 0 at $DIR/cycle.rs:+3:11: +3:17
-+ _4 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
- // mir::Constant
- // + span: $DIR/cycle.rs:13:11: 13:15
- // + literal: Const { ty: fn() -> bool {cond}, val: Value(<ZST>) }
- }
-
- bb2: {
-- switchInt(move _5) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
-+ switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
- }
-
- bb3: {
-- StorageLive(_6); // scope 0 at $DIR/cycle.rs:+4:13: +4:17
-- _6 = _3; // scope 0 at $DIR/cycle.rs:+4:20: +4:21
-- StorageLive(_7); // scope 1 at $DIR/cycle.rs:+5:13: +5:14
-- _7 = _2; // scope 1 at $DIR/cycle.rs:+5:13: +5:14
-- _3 = move _7; // scope 1 at $DIR/cycle.rs:+5:9: +5:14
-- StorageDead(_7); // scope 1 at $DIR/cycle.rs:+5:13: +5:14
-- StorageLive(_8); // scope 1 at $DIR/cycle.rs:+6:13: +6:14
-- _8 = _1; // scope 1 at $DIR/cycle.rs:+6:13: +6:14
-- _2 = move _8; // scope 1 at $DIR/cycle.rs:+6:9: +6:14
-- StorageDead(_8); // scope 1 at $DIR/cycle.rs:+6:13: +6:14
-- StorageLive(_9); // scope 1 at $DIR/cycle.rs:+7:13: +7:17
-- _9 = _6; // scope 1 at $DIR/cycle.rs:+7:13: +7:17
-- _1 = move _9; // scope 1 at $DIR/cycle.rs:+7:9: +7:17
-- StorageDead(_9); // scope 1 at $DIR/cycle.rs:+7:16: +7:17
-- _4 = const (); // scope 0 at $DIR/cycle.rs:+3:18: +8:6
-- StorageDead(_6); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
-+ StorageLive(_5); // scope 0 at $DIR/cycle.rs:+4:13: +4:17
- StorageDead(_5); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
-+ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
- goto -> bb1; // scope 0 at $DIR/cycle.rs:+3:5: +8:6
- }
-
- bb4: {
-- StorageLive(_11); // scope 0 at $DIR/cycle.rs:+3:5: +8:6
- _0 = const (); // scope 0 at $DIR/cycle.rs:+3:5: +8:6
-- StorageDead(_11); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
-- StorageDead(_5); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
-+ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
- return; // scope 0 at $DIR/cycle.rs:+9:2: +9:2
- }
- }
-
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff
new file mode 100644
index 000000000..6221d4780
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff
@@ -0,0 +1,73 @@
+- // MIR for `cycle` before DeadStoreElimination
++ // MIR for `cycle` after DeadStoreElimination
+
+ fn cycle(_1: i32, _2: i32, _3: i32) -> () {
+ debug x => _1;
+ debug y => _2;
+ debug z => _3;
+ let mut _0: ();
+- let mut _4: ();
+- let mut _5: bool;
+- let _6: i32;
+- let mut _7: i32;
+- let mut _8: i32;
+- let mut _9: i32;
+- let mut _10: !;
+- let _11: ();
+- let mut _12: !;
++ let mut _4: bool;
++ let _5: i32;
+ scope 1 {
+- debug temp => _6;
++ debug temp => _5;
+ }
+
+ bb0: {
+ goto -> bb1;
+ }
+
+ bb1: {
+- StorageLive(_5);
+- _5 = cond() -> [return: bb2, unwind unreachable];
++ StorageLive(_4);
++ _4 = cond() -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- switchInt(move _5) -> [0: bb4, otherwise: bb3];
++ switchInt(move _4) -> [0: bb4, otherwise: bb3];
+ }
+
+ bb3: {
+- StorageLive(_6);
+- _6 = _3;
+- StorageLive(_7);
+- _7 = _2;
+- _3 = move _7;
+- StorageDead(_7);
+- StorageLive(_8);
+- _8 = _1;
+- _2 = move _8;
+- StorageDead(_8);
+- StorageLive(_9);
+- _9 = _6;
+- _1 = move _9;
+- StorageDead(_9);
+- _4 = const ();
+- StorageDead(_6);
++ StorageLive(_5);
+ StorageDead(_5);
++ StorageDead(_4);
+ goto -> bb1;
+ }
+
+ bb4: {
+- StorageLive(_11);
+ _0 = const ();
+- StorageDead(_11);
+- StorageDead(_5);
++ StorageDead(_4);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff
new file mode 100644
index 000000000..4b922e05e
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff
@@ -0,0 +1,73 @@
+- // MIR for `cycle` before DeadStoreElimination
++ // MIR for `cycle` after DeadStoreElimination
+
+ fn cycle(_1: i32, _2: i32, _3: i32) -> () {
+ debug x => _1;
+ debug y => _2;
+ debug z => _3;
+ let mut _0: ();
+- let mut _4: ();
+- let mut _5: bool;
+- let _6: i32;
+- let mut _7: i32;
+- let mut _8: i32;
+- let mut _9: i32;
+- let mut _10: !;
+- let _11: ();
+- let mut _12: !;
++ let mut _4: bool;
++ let _5: i32;
+ scope 1 {
+- debug temp => _6;
++ debug temp => _5;
+ }
+
+ bb0: {
+ goto -> bb1;
+ }
+
+ bb1: {
+- StorageLive(_5);
+- _5 = cond() -> [return: bb2, unwind continue];
++ StorageLive(_4);
++ _4 = cond() -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+- switchInt(move _5) -> [0: bb4, otherwise: bb3];
++ switchInt(move _4) -> [0: bb4, otherwise: bb3];
+ }
+
+ bb3: {
+- StorageLive(_6);
+- _6 = _3;
+- StorageLive(_7);
+- _7 = _2;
+- _3 = move _7;
+- StorageDead(_7);
+- StorageLive(_8);
+- _8 = _1;
+- _2 = move _8;
+- StorageDead(_8);
+- StorageLive(_9);
+- _9 = _6;
+- _1 = move _9;
+- StorageDead(_9);
+- _4 = const ();
+- StorageDead(_6);
++ StorageLive(_5);
+ StorageDead(_5);
++ StorageDead(_4);
+ goto -> bb1;
+ }
+
+ bb4: {
+- StorageLive(_11);
+ _0 = const ();
+- StorageDead(_11);
+- StorageDead(_5);
++ StorageDead(_4);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/cycle.rs b/tests/mir-opt/dead-store-elimination/cycle.rs
index 570bfe84d..cd34fe96e 100644
--- a/tests/mir-opt/dead-store-elimination/cycle.rs
+++ b/tests/mir-opt/dead-store-elimination/cycle.rs
@@ -1,4 +1,4 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DeadStoreElimination
#[inline(never)]
diff --git a/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff
index 761c074ed..213051877 100644
--- a/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff
+++ b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff
@@ -2,24 +2,18 @@
+ // MIR for `main` after DeadStoreElimination
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/place_mention.rs:+0:11: +0:11
- let mut _1: (&str, &str); // in scope 0 at $DIR/place_mention.rs:+3:18: +3:36
+ let mut _0: ();
+ let mut _1: (&str, &str);
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
- _1 = (const "Hello", const "World"); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
- // mir::Constant
- // + span: $DIR/place_mention.rs:8:19: 8:26
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- // mir::Constant
- // + span: $DIR/place_mention.rs:8:28: 8:35
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- PlaceMention(_1); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
- StorageDead(_1); // scope 0 at $DIR/place_mention.rs:+3:36: +3:37
- _0 = const (); // scope 0 at $DIR/place_mention.rs:+0:11: +4:2
- return; // scope 0 at $DIR/place_mention.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = (const "Hello", const "World");
+ PlaceMention(_1);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff
index 89f1846b4..31f727e5f 100644
--- a/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff
+++ b/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff
@@ -2,34 +2,34 @@
+ // MIR for `pointer_to_int` after DeadStoreElimination
fn pointer_to_int(_1: *mut i32) -> () {
- debug p => _1; // in scope 0 at $DIR/provenance_soundness.rs:+0:19: +0:20
- let mut _0: (); // return place in scope 0 at $DIR/provenance_soundness.rs:+0:32: +0:32
- let _2: usize; // in scope 0 at $DIR/provenance_soundness.rs:+1:9: +1:11
- let mut _3: *mut i32; // in scope 0 at $DIR/provenance_soundness.rs:+1:14: +1:15
- let mut _5: *mut i32; // in scope 0 at $DIR/provenance_soundness.rs:+2:14: +2:15
+ debug p => _1;
+ let mut _0: ();
+ let _2: usize;
+ let mut _3: *mut i32;
+ let mut _5: *mut i32;
scope 1 {
- debug _x => _2; // in scope 1 at $DIR/provenance_soundness.rs:+1:9: +1:11
- let _4: isize; // in scope 1 at $DIR/provenance_soundness.rs:+2:9: +2:11
+ debug _x => _2;
+ let _4: isize;
scope 2 {
- debug _y => _4; // in scope 2 at $DIR/provenance_soundness.rs:+2:9: +2:11
+ debug _y => _4;
}
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/provenance_soundness.rs:+1:9: +1:11
- StorageLive(_3); // scope 0 at $DIR/provenance_soundness.rs:+1:14: +1:15
- _3 = _1; // scope 0 at $DIR/provenance_soundness.rs:+1:14: +1:15
- _2 = move _3 as usize (PointerExposeAddress); // scope 0 at $DIR/provenance_soundness.rs:+1:14: +1:24
- StorageDead(_3); // scope 0 at $DIR/provenance_soundness.rs:+1:23: +1:24
- StorageLive(_4); // scope 1 at $DIR/provenance_soundness.rs:+2:9: +2:11
- StorageLive(_5); // scope 1 at $DIR/provenance_soundness.rs:+2:14: +2:15
- _5 = _1; // scope 1 at $DIR/provenance_soundness.rs:+2:14: +2:15
- _4 = move _5 as isize (PointerExposeAddress); // scope 1 at $DIR/provenance_soundness.rs:+2:14: +2:24
- StorageDead(_5); // scope 1 at $DIR/provenance_soundness.rs:+2:23: +2:24
- _0 = const (); // scope 0 at $DIR/provenance_soundness.rs:+0:32: +3:2
- StorageDead(_4); // scope 1 at $DIR/provenance_soundness.rs:+3:1: +3:2
- StorageDead(_2); // scope 0 at $DIR/provenance_soundness.rs:+3:1: +3:2
- return; // scope 0 at $DIR/provenance_soundness.rs:+3:2: +3:2
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = move _3 as usize (PointerExposeAddress);
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = move _5 as isize (PointerExposeAddress);
+ StorageDead(_5);
+ _0 = const ();
+ StorageDead(_4);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff
index b5f98233b..e1ebc39aa 100644
--- a/tests/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff
+++ b/tests/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff
@@ -2,13 +2,13 @@
+ // MIR for `retags` after DeadStoreElimination
fn retags(_1: &mut i32) -> () {
- debug _r => _1; // in scope 0 at $DIR/provenance_soundness.rs:+0:11: +0:13
- let mut _0: (); // return place in scope 0 at $DIR/provenance_soundness.rs:+0:25: +0:25
+ debug _r => _1;
+ let mut _0: ();
bb0: {
- Retag([fn entry] _1); // scope 0 at $DIR/provenance_soundness.rs:+0:11: +0:13
- _0 = const (); // scope 0 at $DIR/provenance_soundness.rs:+0:25: +0:27
- return; // scope 0 at $DIR/provenance_soundness.rs:+0:27: +0:27
+ Retag([fn entry] _1);
+ _0 = const ();
+ return;
}
}