diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-04-25 20:09:41 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-04-29 16:14:32 +0000 |
| commit | 77dac91d4f6f7200032f9219a92aad240b000a63 (patch) | |
| tree | 3dd2f94c9e403fbe5c3a11e9f7fe0441e44f73a0 | |
| parent | 6ce22733b973355573efd1e6294e585460e90e17 (diff) | |
| download | rust-77dac91d4f6f7200032f9219a92aad240b000a63.tar.gz rust-77dac91d4f6f7200032f9219a92aad240b000a63.zip | |
Add test.
| -rw-r--r-- | tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff | 25 | ||||
| -rw-r--r-- | tests/mir-opt/dead-store-elimination/place_mention.rs | 9 |
2 files changed, 34 insertions, 0 deletions
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 new file mode 100644 index 00000000000..73aadf3b231 --- /dev/null +++ b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff @@ -0,0 +1,25 @@ +- // MIR for `main` before DeadStoreElimination ++ // 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 + 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 + } + } + diff --git a/tests/mir-opt/dead-store-elimination/place_mention.rs b/tests/mir-opt/dead-store-elimination/place_mention.rs new file mode 100644 index 00000000000..59dc74454a4 --- /dev/null +++ b/tests/mir-opt/dead-store-elimination/place_mention.rs @@ -0,0 +1,9 @@ +// unit-test: DeadStoreElimination +// compile-flags: -Zmir-keep-place-mention + +// EMIT_MIR place_mention.main.DeadStoreElimination.diff +fn main() { + // Verify that we account for the `PlaceMention` statement as a use of the tuple, + // and don't remove it as a dead store. + let (_, _) = ("Hello", "World"); +} |
