From 665a98d21f926fbd8a89fe2af7c448ff34deadc3 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sat, 12 Sep 2020 15:10:51 +0200 Subject: [PATCH] Fix dest-prop mir-opt tests --- ...> branch.main.DestinationPropagation.diff} | 23 +++------------- src/test/mir-opt/dest-prop/branch.rs | 2 +- ...=> cycle.main.DestinationPropagation.diff} | 25 ++++------------- src/test/mir-opt/dest-prop/cycle.rs | 2 +- ...> simple.nrvo.DestinationPropagation.diff} | 27 ++++++------------- src/test/mir-opt/dest-prop/simple.rs | 2 +- ...=> union.main.DestinationPropagation.diff} | 23 +++------------- src/test/mir-opt/dest-prop/union.rs | 2 +- 8 files changed, 25 insertions(+), 81 deletions(-) rename src/test/mir-opt/dest-prop/{branch/rustc.main.DestinationPropagation.diff => branch.main.DestinationPropagation.diff} (74%) rename src/test/mir-opt/dest-prop/{cycle/rustc.main.DestinationPropagation.diff => cycle.main.DestinationPropagation.diff} (78%) rename src/test/mir-opt/dest-prop/{simple/rustc.nrvo.DestinationPropagation.diff => simple.nrvo.DestinationPropagation.diff} (63%) rename src/test/mir-opt/dest-prop/{union/rustc.main.DestinationPropagation.diff => union.main.DestinationPropagation.diff} (65%) diff --git a/src/test/mir-opt/dest-prop/branch/rustc.main.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff similarity index 74% rename from src/test/mir-opt/dest-prop/branch/rustc.main.DestinationPropagation.diff rename to src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff index b8387ae449387..9c213eaed3c04 100644 --- a/src/test/mir-opt/dest-prop/branch/rustc.main.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff @@ -17,12 +17,9 @@ bb0: { - StorageLive(_1); // scope 0 at $DIR/branch.rs:13:9: 13:10 -- _1 = const val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18 +- _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18 + nop; // scope 0 at $DIR/branch.rs:13:9: 13:10 -+ _2 = const val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18 - // ty::Const - // + ty: fn() -> i32 {val} - // + val: Value(Scalar()) ++ _2 = val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18 // mir::Constant // + span: $DIR/branch.rs:13:13: 13:16 // + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar()) } @@ -32,10 +29,7 @@ - StorageLive(_2); // scope 1 at $DIR/branch.rs:15:9: 15:10 + nop; // scope 1 at $DIR/branch.rs:15:9: 15:10 StorageLive(_3); // scope 1 at $DIR/branch.rs:15:16: 15:22 - _3 = const cond() -> bb2; // scope 1 at $DIR/branch.rs:15:16: 15:22 - // ty::Const - // + ty: fn() -> bool {cond} - // + val: Value(Scalar()) + _3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:15:16: 15:22 // mir::Constant // + span: $DIR/branch.rs:15:16: 15:20 // + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar()) } @@ -47,10 +41,7 @@ bb3: { StorageLive(_4); // scope 1 at $DIR/branch.rs:18:9: 18:14 - _4 = const val() -> bb5; // scope 1 at $DIR/branch.rs:18:9: 18:14 - // ty::Const - // + ty: fn() -> i32 {val} - // + val: Value(Scalar()) + _4 = val() -> bb5; // scope 1 at $DIR/branch.rs:18:9: 18:14 // mir::Constant // + span: $DIR/branch.rs:18:9: 18:12 // + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar()) } @@ -72,12 +63,6 @@ bb6: { StorageDead(_3); // scope 1 at $DIR/branch.rs:20:6: 20:7 _0 = const (); // scope 0 at $DIR/branch.rs:12:11: 21:2 - // ty::Const - // + ty: () - // + val: Value(Scalar()) - // mir::Constant - // + span: $DIR/branch.rs:12:11: 21:2 - // + literal: Const { ty: (), val: Value(Scalar()) } - StorageDead(_2); // scope 1 at $DIR/branch.rs:21:1: 21:2 - StorageDead(_1); // scope 0 at $DIR/branch.rs:21:1: 21:2 + nop; // scope 1 at $DIR/branch.rs:21:1: 21:2 diff --git a/src/test/mir-opt/dest-prop/branch.rs b/src/test/mir-opt/dest-prop/branch.rs index b49ecf07daa39..7e0e40671ddb2 100644 --- a/src/test/mir-opt/dest-prop/branch.rs +++ b/src/test/mir-opt/dest-prop/branch.rs @@ -8,7 +8,7 @@ fn cond() -> bool { true } -// EMIT_MIR rustc.main.DestinationPropagation.diff +// EMIT_MIR branch.main.DestinationPropagation.diff fn main() { let x = val(); diff --git a/src/test/mir-opt/dest-prop/cycle/rustc.main.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff similarity index 78% rename from src/test/mir-opt/dest-prop/cycle/rustc.main.DestinationPropagation.diff rename to src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff index 5189b665acff1..dd717c1b9c324 100644 --- a/src/test/mir-opt/dest-prop/cycle/rustc.main.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff @@ -19,7 +19,7 @@ - debug z => _3; // in scope 3 at $DIR/cycle.rs:11:9: 11:10 + debug z => _4; // in scope 3 at $DIR/cycle.rs:11:9: 11:10 scope 4 { - debug _x => _6; // in scope 4 at $SRC_DIR/libcore/mem/mod.rs:LL:COL + debug _x => _6; // in scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL } } } @@ -27,12 +27,9 @@ bb0: { - StorageLive(_1); // scope 0 at $DIR/cycle.rs:9:9: 9:14 -- _1 = const val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22 +- _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22 + nop; // scope 0 at $DIR/cycle.rs:9:9: 9:14 -+ _4 = const val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22 - // ty::Const - // + ty: fn() -> i32 {val} - // + val: Value(Scalar()) ++ _4 = val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22 // mir::Constant // + span: $DIR/cycle.rs:9:17: 9:20 // + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar()) } @@ -59,26 +56,14 @@ StorageLive(_6); // scope 3 at $DIR/cycle.rs:14:10: 14:11 - _6 = _1; // scope 3 at $DIR/cycle.rs:14:10: 14:11 + _6 = _4; // scope 3 at $DIR/cycle.rs:14:10: 14:11 - _5 = const (); // scope 4 at $SRC_DIR/libcore/mem/mod.rs:LL:COL - // ty::Const - // + ty: () - // + val: Value(Scalar()) - // mir::Constant - // + span: $SRC_DIR/libcore/mem/mod.rs:LL:COL - // + literal: Const { ty: (), val: Value(Scalar()) } - drop(_6) -> bb2; // scope 4 at $SRC_DIR/libcore/mem/mod.rs:LL:COL + _5 = const (); // scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + drop(_6) -> bb2; // scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL } bb2: { StorageDead(_6); // scope 3 at $DIR/cycle.rs:14:11: 14:12 StorageDead(_5); // scope 3 at $DIR/cycle.rs:14:12: 14:13 _0 = const (); // scope 0 at $DIR/cycle.rs:8:11: 15:2 - // ty::Const - // + ty: () - // + val: Value(Scalar()) - // mir::Constant - // + span: $DIR/cycle.rs:8:11: 15:2 - // + literal: Const { ty: (), val: Value(Scalar()) } - StorageDead(_3); // scope 2 at $DIR/cycle.rs:15:1: 15:2 - StorageDead(_2); // scope 1 at $DIR/cycle.rs:15:1: 15:2 - StorageDead(_1); // scope 0 at $DIR/cycle.rs:15:1: 15:2 diff --git a/src/test/mir-opt/dest-prop/cycle.rs b/src/test/mir-opt/dest-prop/cycle.rs index d55d527bc65f6..7fbffb1335946 100644 --- a/src/test/mir-opt/dest-prop/cycle.rs +++ b/src/test/mir-opt/dest-prop/cycle.rs @@ -4,7 +4,7 @@ fn val() -> i32 { 1 } -// EMIT_MIR rustc.main.DestinationPropagation.diff +// EMIT_MIR cycle.main.DestinationPropagation.diff fn main() { let mut x = val(); let y = x; diff --git a/src/test/mir-opt/dest-prop/simple/rustc.nrvo.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff similarity index 63% rename from src/test/mir-opt/dest-prop/simple/rustc.nrvo.DestinationPropagation.diff rename to src/test/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff index d59e1f3c0c938..1277c51f2a050 100644 --- a/src/test/mir-opt/dest-prop/simple/rustc.nrvo.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff @@ -16,35 +16,24 @@ bb0: { - StorageLive(_2); // scope 0 at $DIR/simple.rs:5:9: 5:16 -- _2 = [const 0u8; 1024]; // scope 0 at $DIR/simple.rs:5:19: 5:28 +- _2 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:5:19: 5:28 + nop; // scope 0 at $DIR/simple.rs:5:9: 5:16 -+ _0 = [const 0u8; 1024]; // scope 0 at $DIR/simple.rs:5:19: 5:28 - // ty::Const - // + ty: u8 - // + val: Value(Scalar(0x00)) - // mir::Constant - // + span: $DIR/simple.rs:5:20: 5:21 - // + literal: Const { ty: u8, val: Value(Scalar(0x00)) } ++ _0 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:5:19: 5:28 StorageLive(_3); // scope 1 at $DIR/simple.rs:6:5: 6:19 StorageLive(_4); // scope 1 at $DIR/simple.rs:6:5: 6:9 _4 = _1; // scope 1 at $DIR/simple.rs:6:5: 6:9 -- StorageLive(_5); // scope 1 at $DIR/simple.rs:6:10: 6:18 -- StorageLive(_6); // scope 1 at $DIR/simple.rs:6:10: 6:18 + StorageLive(_5); // scope 1 at $DIR/simple.rs:6:10: 6:18 + StorageLive(_6); // scope 1 at $DIR/simple.rs:6:10: 6:18 - _6 = &mut _2; // scope 1 at $DIR/simple.rs:6:10: 6:18 -- _5 = move _6; // scope 1 at $DIR/simple.rs:6:10: 6:18 -+ nop; // scope 1 at $DIR/simple.rs:6:10: 6:18 -+ nop; // scope 1 at $DIR/simple.rs:6:10: 6:18 -+ _5 = &mut _0; // scope 1 at $DIR/simple.rs:6:10: 6:18 -+ nop; // scope 1 at $DIR/simple.rs:6:10: 6:18 ++ _6 = &mut _0; // scope 1 at $DIR/simple.rs:6:10: 6:18 + _5 = &mut (*_6); // scope 1 at $DIR/simple.rs:6:10: 6:18 _3 = move _4(move _5) -> bb1; // scope 1 at $DIR/simple.rs:6:5: 6:19 } bb1: { -- StorageDead(_5); // scope 1 at $DIR/simple.rs:6:18: 6:19 -+ nop; // scope 1 at $DIR/simple.rs:6:18: 6:19 + StorageDead(_5); // scope 1 at $DIR/simple.rs:6:18: 6:19 StorageDead(_4); // scope 1 at $DIR/simple.rs:6:18: 6:19 -- StorageDead(_6); // scope 1 at $DIR/simple.rs:6:19: 6:20 -+ nop; // scope 1 at $DIR/simple.rs:6:19: 6:20 + StorageDead(_6); // scope 1 at $DIR/simple.rs:6:19: 6:20 StorageDead(_3); // scope 1 at $DIR/simple.rs:6:19: 6:20 - _0 = _2; // scope 1 at $DIR/simple.rs:7:5: 7:8 - StorageDead(_2); // scope 0 at $DIR/simple.rs:8:1: 8:2 diff --git a/src/test/mir-opt/dest-prop/simple.rs b/src/test/mir-opt/dest-prop/simple.rs index add821eafe0b0..4655f96699874 100644 --- a/src/test/mir-opt/dest-prop/simple.rs +++ b/src/test/mir-opt/dest-prop/simple.rs @@ -1,6 +1,6 @@ //! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too. -// EMIT_MIR rustc.nrvo.DestinationPropagation.diff +// EMIT_MIR simple.nrvo.DestinationPropagation.diff fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { let mut buf = [0; 1024]; init(&mut buf); diff --git a/src/test/mir-opt/dest-prop/union/rustc.main.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/union.main.DestinationPropagation.diff similarity index 65% rename from src/test/mir-opt/dest-prop/union/rustc.main.DestinationPropagation.diff rename to src/test/mir-opt/dest-prop/union.main.DestinationPropagation.diff index f6ebb6cb9403d..871f6e35043ec 100644 --- a/src/test/mir-opt/dest-prop/union/rustc.main.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/union.main.DestinationPropagation.diff @@ -12,17 +12,14 @@ scope 2 { } scope 3 { - debug _x => _4; // in scope 3 at $SRC_DIR/libcore/mem/mod.rs:LL:COL + debug _x => _4; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL } } bb0: { StorageLive(_1); // scope 0 at $DIR/union.rs:13:9: 13:11 StorageLive(_2); // scope 0 at $DIR/union.rs:13:23: 13:28 - _2 = const val() -> bb1; // scope 0 at $DIR/union.rs:13:23: 13:28 - // ty::Const - // + ty: fn() -> u32 {val} - // + val: Value(Scalar()) + _2 = val() -> bb1; // scope 0 at $DIR/union.rs:13:23: 13:28 // mir::Constant // + span: $DIR/union.rs:13:23: 13:26 // + literal: Const { ty: fn() -> u32 {val}, val: Value(Scalar()) } @@ -34,26 +31,14 @@ StorageLive(_3); // scope 1 at $DIR/union.rs:15:5: 15:27 StorageLive(_4); // scope 1 at $DIR/union.rs:15:10: 15:26 _4 = (_1.0: u32); // scope 2 at $DIR/union.rs:15:19: 15:24 - _3 = const (); // scope 3 at $SRC_DIR/libcore/mem/mod.rs:LL:COL - // ty::Const - // + ty: () - // + val: Value(Scalar()) - // mir::Constant - // + span: $SRC_DIR/libcore/mem/mod.rs:LL:COL - // + literal: Const { ty: (), val: Value(Scalar()) } - drop(_4) -> bb2; // scope 3 at $SRC_DIR/libcore/mem/mod.rs:LL:COL + _3 = const (); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + drop(_4) -> bb2; // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL } bb2: { StorageDead(_4); // scope 1 at $DIR/union.rs:15:26: 15:27 StorageDead(_3); // scope 1 at $DIR/union.rs:15:27: 15:28 _0 = const (); // scope 0 at $DIR/union.rs:8:11: 16:2 - // ty::Const - // + ty: () - // + val: Value(Scalar()) - // mir::Constant - // + span: $DIR/union.rs:8:11: 16:2 - // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // scope 0 at $DIR/union.rs:16:1: 16:2 return; // scope 0 at $DIR/union.rs:16:2: 16:2 } diff --git a/src/test/mir-opt/dest-prop/union.rs b/src/test/mir-opt/dest-prop/union.rs index ea8364124043e..b9d831389e8b3 100644 --- a/src/test/mir-opt/dest-prop/union.rs +++ b/src/test/mir-opt/dest-prop/union.rs @@ -4,7 +4,7 @@ fn val() -> u32 { 1 } -// EMIT_MIR rustc.main.DestinationPropagation.diff +// EMIT_MIR union.main.DestinationPropagation.diff fn main() { union Un { us: u32,