Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 665a98d

Browse files
Fix dest-prop mir-opt tests
1 parent 402f863 commit 665a98d

8 files changed

+25
-81
lines changed

src/test/mir-opt/dest-prop/branch/rustc.main.DestinationPropagation.diff renamed to src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@
1717

1818
bb0: {
1919
- StorageLive(_1); // scope 0 at $DIR/branch.rs:13:9: 13:10
20-
- _1 = const val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18
20+
- _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18
2121
+ nop; // scope 0 at $DIR/branch.rs:13:9: 13:10
22-
+ _2 = const val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18
23-
// ty::Const
24-
// + ty: fn() -> i32 {val}
25-
// + val: Value(Scalar(<ZST>))
22+
+ _2 = val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18
2623
// mir::Constant
2724
// + span: $DIR/branch.rs:13:13: 13:16
2825
// + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar(<ZST>)) }
@@ -32,10 +29,7 @@
3229
- StorageLive(_2); // scope 1 at $DIR/branch.rs:15:9: 15:10
3330
+ nop; // scope 1 at $DIR/branch.rs:15:9: 15:10
3431
StorageLive(_3); // scope 1 at $DIR/branch.rs:15:16: 15:22
35-
_3 = const cond() -> bb2; // scope 1 at $DIR/branch.rs:15:16: 15:22
36-
// ty::Const
37-
// + ty: fn() -> bool {cond}
38-
// + val: Value(Scalar(<ZST>))
32+
_3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:15:16: 15:22
3933
// mir::Constant
4034
// + span: $DIR/branch.rs:15:16: 15:20
4135
// + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar(<ZST>)) }
@@ -47,10 +41,7 @@
4741

4842
bb3: {
4943
StorageLive(_4); // scope 1 at $DIR/branch.rs:18:9: 18:14
50-
_4 = const val() -> bb5; // scope 1 at $DIR/branch.rs:18:9: 18:14
51-
// ty::Const
52-
// + ty: fn() -> i32 {val}
53-
// + val: Value(Scalar(<ZST>))
44+
_4 = val() -> bb5; // scope 1 at $DIR/branch.rs:18:9: 18:14
5445
// mir::Constant
5546
// + span: $DIR/branch.rs:18:9: 18:12
5647
// + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar(<ZST>)) }
@@ -72,12 +63,6 @@
7263
bb6: {
7364
StorageDead(_3); // scope 1 at $DIR/branch.rs:20:6: 20:7
7465
_0 = const (); // scope 0 at $DIR/branch.rs:12:11: 21:2
75-
// ty::Const
76-
// + ty: ()
77-
// + val: Value(Scalar(<ZST>))
78-
// mir::Constant
79-
// + span: $DIR/branch.rs:12:11: 21:2
80-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
8166
- StorageDead(_2); // scope 1 at $DIR/branch.rs:21:1: 21:2
8267
- StorageDead(_1); // scope 0 at $DIR/branch.rs:21:1: 21:2
8368
+ nop; // scope 1 at $DIR/branch.rs:21:1: 21:2

src/test/mir-opt/dest-prop/branch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn cond() -> bool {
88
true
99
}
1010

11-
// EMIT_MIR rustc.main.DestinationPropagation.diff
11+
// EMIT_MIR branch.main.DestinationPropagation.diff
1212
fn main() {
1313
let x = val();
1414

src/test/mir-opt/dest-prop/cycle/rustc.main.DestinationPropagation.diff renamed to src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,17 @@
1919
- debug z => _3; // in scope 3 at $DIR/cycle.rs:11:9: 11:10
2020
+ debug z => _4; // in scope 3 at $DIR/cycle.rs:11:9: 11:10
2121
scope 4 {
22-
debug _x => _6; // in scope 4 at $SRC_DIR/libcore/mem/mod.rs:LL:COL
22+
debug _x => _6; // in scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
2323
}
2424
}
2525
}
2626
}
2727

2828
bb0: {
2929
- StorageLive(_1); // scope 0 at $DIR/cycle.rs:9:9: 9:14
30-
- _1 = const val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22
30+
- _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22
3131
+ nop; // scope 0 at $DIR/cycle.rs:9:9: 9:14
32-
+ _4 = const val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22
33-
// ty::Const
34-
// + ty: fn() -> i32 {val}
35-
// + val: Value(Scalar(<ZST>))
32+
+ _4 = val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22
3633
// mir::Constant
3734
// + span: $DIR/cycle.rs:9:17: 9:20
3835
// + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar(<ZST>)) }
@@ -59,26 +56,14 @@
5956
StorageLive(_6); // scope 3 at $DIR/cycle.rs:14:10: 14:11
6057
- _6 = _1; // scope 3 at $DIR/cycle.rs:14:10: 14:11
6158
+ _6 = _4; // scope 3 at $DIR/cycle.rs:14:10: 14:11
62-
_5 = const (); // scope 4 at $SRC_DIR/libcore/mem/mod.rs:LL:COL
63-
// ty::Const
64-
// + ty: ()
65-
// + val: Value(Scalar(<ZST>))
66-
// mir::Constant
67-
// + span: $SRC_DIR/libcore/mem/mod.rs:LL:COL
68-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
69-
drop(_6) -> bb2; // scope 4 at $SRC_DIR/libcore/mem/mod.rs:LL:COL
59+
_5 = const (); // scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
60+
drop(_6) -> bb2; // scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
7061
}
7162

7263
bb2: {
7364
StorageDead(_6); // scope 3 at $DIR/cycle.rs:14:11: 14:12
7465
StorageDead(_5); // scope 3 at $DIR/cycle.rs:14:12: 14:13
7566
_0 = const (); // scope 0 at $DIR/cycle.rs:8:11: 15:2
76-
// ty::Const
77-
// + ty: ()
78-
// + val: Value(Scalar(<ZST>))
79-
// mir::Constant
80-
// + span: $DIR/cycle.rs:8:11: 15:2
81-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
8267
- StorageDead(_3); // scope 2 at $DIR/cycle.rs:15:1: 15:2
8368
- StorageDead(_2); // scope 1 at $DIR/cycle.rs:15:1: 15:2
8469
- StorageDead(_1); // scope 0 at $DIR/cycle.rs:15:1: 15:2

src/test/mir-opt/dest-prop/cycle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn val() -> i32 {
44
1
55
}
66

7-
// EMIT_MIR rustc.main.DestinationPropagation.diff
7+
// EMIT_MIR cycle.main.DestinationPropagation.diff
88
fn main() {
99
let mut x = val();
1010
let y = x;

src/test/mir-opt/dest-prop/simple/rustc.nrvo.DestinationPropagation.diff renamed to src/test/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,24 @@
1616

1717
bb0: {
1818
- StorageLive(_2); // scope 0 at $DIR/simple.rs:5:9: 5:16
19-
- _2 = [const 0u8; 1024]; // scope 0 at $DIR/simple.rs:5:19: 5:28
19+
- _2 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:5:19: 5:28
2020
+ nop; // scope 0 at $DIR/simple.rs:5:9: 5:16
21-
+ _0 = [const 0u8; 1024]; // scope 0 at $DIR/simple.rs:5:19: 5:28
22-
// ty::Const
23-
// + ty: u8
24-
// + val: Value(Scalar(0x00))
25-
// mir::Constant
26-
// + span: $DIR/simple.rs:5:20: 5:21
27-
// + literal: Const { ty: u8, val: Value(Scalar(0x00)) }
21+
+ _0 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:5:19: 5:28
2822
StorageLive(_3); // scope 1 at $DIR/simple.rs:6:5: 6:19
2923
StorageLive(_4); // scope 1 at $DIR/simple.rs:6:5: 6:9
3024
_4 = _1; // scope 1 at $DIR/simple.rs:6:5: 6:9
31-
- StorageLive(_5); // scope 1 at $DIR/simple.rs:6:10: 6:18
32-
- StorageLive(_6); // scope 1 at $DIR/simple.rs:6:10: 6:18
25+
StorageLive(_5); // scope 1 at $DIR/simple.rs:6:10: 6:18
26+
StorageLive(_6); // scope 1 at $DIR/simple.rs:6:10: 6:18
3327
- _6 = &mut _2; // scope 1 at $DIR/simple.rs:6:10: 6:18
34-
- _5 = move _6; // scope 1 at $DIR/simple.rs:6:10: 6:18
35-
+ nop; // scope 1 at $DIR/simple.rs:6:10: 6:18
36-
+ nop; // scope 1 at $DIR/simple.rs:6:10: 6:18
37-
+ _5 = &mut _0; // scope 1 at $DIR/simple.rs:6:10: 6:18
38-
+ nop; // scope 1 at $DIR/simple.rs:6:10: 6:18
28+
+ _6 = &mut _0; // scope 1 at $DIR/simple.rs:6:10: 6:18
29+
_5 = &mut (*_6); // scope 1 at $DIR/simple.rs:6:10: 6:18
3930
_3 = move _4(move _5) -> bb1; // scope 1 at $DIR/simple.rs:6:5: 6:19
4031
}
4132

4233
bb1: {
43-
- StorageDead(_5); // scope 1 at $DIR/simple.rs:6:18: 6:19
44-
+ nop; // scope 1 at $DIR/simple.rs:6:18: 6:19
34+
StorageDead(_5); // scope 1 at $DIR/simple.rs:6:18: 6:19
4535
StorageDead(_4); // scope 1 at $DIR/simple.rs:6:18: 6:19
46-
- StorageDead(_6); // scope 1 at $DIR/simple.rs:6:19: 6:20
47-
+ nop; // scope 1 at $DIR/simple.rs:6:19: 6:20
36+
StorageDead(_6); // scope 1 at $DIR/simple.rs:6:19: 6:20
4837
StorageDead(_3); // scope 1 at $DIR/simple.rs:6:19: 6:20
4938
- _0 = _2; // scope 1 at $DIR/simple.rs:7:5: 7:8
5039
- StorageDead(_2); // scope 0 at $DIR/simple.rs:8:1: 8:2

src/test/mir-opt/dest-prop/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too.
22
3-
// EMIT_MIR rustc.nrvo.DestinationPropagation.diff
3+
// EMIT_MIR simple.nrvo.DestinationPropagation.diff
44
fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] {
55
let mut buf = [0; 1024];
66
init(&mut buf);

src/test/mir-opt/dest-prop/union/rustc.main.DestinationPropagation.diff renamed to src/test/mir-opt/dest-prop/union.main.DestinationPropagation.diff

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@
1212
scope 2 {
1313
}
1414
scope 3 {
15-
debug _x => _4; // in scope 3 at $SRC_DIR/libcore/mem/mod.rs:LL:COL
15+
debug _x => _4; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
1616
}
1717
}
1818

1919
bb0: {
2020
StorageLive(_1); // scope 0 at $DIR/union.rs:13:9: 13:11
2121
StorageLive(_2); // scope 0 at $DIR/union.rs:13:23: 13:28
22-
_2 = const val() -> bb1; // scope 0 at $DIR/union.rs:13:23: 13:28
23-
// ty::Const
24-
// + ty: fn() -> u32 {val}
25-
// + val: Value(Scalar(<ZST>))
22+
_2 = val() -> bb1; // scope 0 at $DIR/union.rs:13:23: 13:28
2623
// mir::Constant
2724
// + span: $DIR/union.rs:13:23: 13:26
2825
// + literal: Const { ty: fn() -> u32 {val}, val: Value(Scalar(<ZST>)) }
@@ -34,26 +31,14 @@
3431
StorageLive(_3); // scope 1 at $DIR/union.rs:15:5: 15:27
3532
StorageLive(_4); // scope 1 at $DIR/union.rs:15:10: 15:26
3633
_4 = (_1.0: u32); // scope 2 at $DIR/union.rs:15:19: 15:24
37-
_3 = const (); // scope 3 at $SRC_DIR/libcore/mem/mod.rs:LL:COL
38-
// ty::Const
39-
// + ty: ()
40-
// + val: Value(Scalar(<ZST>))
41-
// mir::Constant
42-
// + span: $SRC_DIR/libcore/mem/mod.rs:LL:COL
43-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
44-
drop(_4) -> bb2; // scope 3 at $SRC_DIR/libcore/mem/mod.rs:LL:COL
34+
_3 = const (); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
35+
drop(_4) -> bb2; // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
4536
}
4637

4738
bb2: {
4839
StorageDead(_4); // scope 1 at $DIR/union.rs:15:26: 15:27
4940
StorageDead(_3); // scope 1 at $DIR/union.rs:15:27: 15:28
5041
_0 = const (); // scope 0 at $DIR/union.rs:8:11: 16:2
51-
// ty::Const
52-
// + ty: ()
53-
// + val: Value(Scalar(<ZST>))
54-
// mir::Constant
55-
// + span: $DIR/union.rs:8:11: 16:2
56-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
5742
StorageDead(_1); // scope 0 at $DIR/union.rs:16:1: 16:2
5843
return; // scope 0 at $DIR/union.rs:16:2: 16:2
5944
}

src/test/mir-opt/dest-prop/union.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn val() -> u32 {
44
1
55
}
66

7-
// EMIT_MIR rustc.main.DestinationPropagation.diff
7+
// EMIT_MIR union.main.DestinationPropagation.diff
88
fn main() {
99
union Un {
1010
us: u32,

0 commit comments

Comments
 (0)