Skip to content

Commit

Permalink
Fix dest-prop mir-opt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-schievink committed Sep 18, 2020
1 parent 402f863 commit 665a98d
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 81 deletions.
Expand Up @@ -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(<ZST>))
+ _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(<ZST>)) }
Expand All @@ -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(<ZST>))
_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(<ZST>)) }
Expand All @@ -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(<ZST>))
_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(<ZST>)) }
Expand All @@ -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(<ZST>))
// mir::Constant
// + span: $DIR/branch.rs:12:11: 21:2
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
- 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
Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/dest-prop/branch.rs
Expand Up @@ -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();

Expand Down
Expand Up @@ -19,20 +19,17 @@
- 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
}
}
}
}

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(<ZST>))
+ _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(<ZST>)) }
Expand All @@ -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(<ZST>))
// mir::Constant
// + span: $SRC_DIR/libcore/mem/mod.rs:LL:COL
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
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(<ZST>))
// mir::Constant
// + span: $DIR/cycle.rs:8:11: 15:2
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
- 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
Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/dest-prop/cycle.rs
Expand Up @@ -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;
Expand Down
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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);
Expand Down
Expand Up @@ -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(<ZST>))
_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(<ZST>)) }
Expand All @@ -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(<ZST>))
// mir::Constant
// + span: $SRC_DIR/libcore/mem/mod.rs:LL:COL
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
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(<ZST>))
// mir::Constant
// + span: $DIR/union.rs:8:11: 16:2
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
StorageDead(_1); // scope 0 at $DIR/union.rs:16:1: 16:2
return; // scope 0 at $DIR/union.rs:16:2: 16:2
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/dest-prop/union.rs
Expand Up @@ -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,
Expand Down

0 comments on commit 665a98d

Please sign in to comment.