Skip to content

Commit 1cd4e9d

Browse files
committed
Update the tests after the change to copy_prop
1 parent 76458a1 commit 1cd4e9d

5 files changed

+155
-96
lines changed

tests/mir-opt/copy-prop/borrowed_local.borrow_in_loop.CopyProp.panic-abort.diff

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
}
4444

4545
bb1: {
46-
- StorageLive(_6);
46+
StorageLive(_6);
4747
StorageLive(_7);
4848
_7 = copy (*_2);
4949
_6 = Not(move _7);
5050
StorageDead(_7);
51-
- StorageLive(_8);
51+
StorageLive(_8);
5252
StorageLive(_9);
5353
_9 = copy (*_2);
5454
_8 = Not(move _9);
@@ -80,8 +80,8 @@
8080
- StorageDead(_14);
8181
_0 = const ();
8282
StorageDead(_13);
83-
- StorageDead(_8);
84-
- StorageDead(_6);
83+
StorageDead(_8);
84+
StorageDead(_6);
8585
- StorageDead(_4);
8686
StorageDead(_2);
8787
StorageDead(_1);
@@ -93,8 +93,8 @@
9393
- StorageDead(_14);
9494
- _5 = const ();
9595
StorageDead(_13);
96-
- StorageDead(_8);
97-
- StorageDead(_6);
96+
StorageDead(_8);
97+
StorageDead(_6);
9898
goto -> bb1;
9999
}
100100
}

tests/mir-opt/copy-prop/borrowed_local.borrow_in_loop.CopyProp.panic-unwind.diff

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
}
4444

4545
bb1: {
46-
- StorageLive(_6);
46+
StorageLive(_6);
4747
StorageLive(_7);
4848
_7 = copy (*_2);
4949
_6 = Not(move _7);
5050
StorageDead(_7);
51-
- StorageLive(_8);
51+
StorageLive(_8);
5252
StorageLive(_9);
5353
_9 = copy (*_2);
5454
_8 = Not(move _9);
@@ -80,8 +80,8 @@
8080
- StorageDead(_14);
8181
_0 = const ();
8282
StorageDead(_13);
83-
- StorageDead(_8);
84-
- StorageDead(_6);
83+
StorageDead(_8);
84+
StorageDead(_6);
8585
- StorageDead(_4);
8686
StorageDead(_2);
8787
StorageDead(_1);
@@ -93,8 +93,8 @@
9393
- StorageDead(_14);
9494
- _5 = const ();
9595
StorageDead(_13);
96-
- StorageDead(_8);
97-
- StorageDead(_6);
96+
StorageDead(_8);
97+
StorageDead(_6);
9898
goto -> bb1;
9999
}
100100
}

tests/mir-opt/copy-prop/copy_prop_storage_removed_when_local_borrowed.f.CopyProp.diff

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
let mut _4: &T;
99

1010
bb0: {
11-
- StorageLive(_2);
11+
StorageLive(_2);
1212
_2 = copy (_1.0: T);
13-
- _3 = copy _2;
14-
- _4 = &_3;
15-
- StorageDead(_2);
16-
+ _4 = &_2;
13+
_3 = copy _2;
14+
_4 = &_3;
15+
StorageDead(_2);
1716
_0 = copy (*_4);
1817
return;
1918
}

tests/mir-opt/copy-prop/copy_prop_storage_removed_when_local_borrowed.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ pub fn f<T: Copy + Freeze>(_1: (T, T)) -> T {
1818
let _4: &T;
1919
// CHECK: bb0: {
2020
{
21-
// CHECK-NOT: StorageLive(_2);
22-
// CHECK: _4 = &_2;
23-
// CHECK-NOT: StorageDead(_2);
21+
// FIXME: Currently, copy propagation will not unify borrowed locals.
22+
// If it does, the storage statements for `_2` should be remove
23+
// so these checks will need to be updated.
24+
// CHECK: StorageLive(_2);
25+
// CHECK: _4 = &_3;
26+
// CHECK: StorageDead(_2);
2427
StorageLive(_2);
2528
_2 = _1.0;
2629
_3 = _2;

tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir

Lines changed: 133 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,134 +3,191 @@
33
fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2: &&(usize, usize, usize, usize)) -> bool {
44
let mut _0: bool;
55
let mut _3: &(usize, usize, usize, usize);
6-
let mut _6: bool;
7-
let mut _9: bool;
8-
let mut _10: bool;
9-
let _13: &usize;
10-
let _14: &usize;
6+
let _4: &usize;
7+
let _5: &usize;
8+
let _6: &usize;
9+
let _7: &usize;
10+
let mut _8: &&usize;
11+
let _9: &usize;
12+
let mut _10: &&usize;
13+
let mut _13: bool;
14+
let mut _14: &&usize;
1115
let _15: &usize;
12-
let _16: &usize;
13-
let mut _17: &&usize;
14-
let mut _18: &&usize;
15-
let mut _19: &&usize;
16+
let mut _16: &&usize;
17+
let mut _19: bool;
1618
let mut _20: &&usize;
17-
let mut _21: &&usize;
19+
let _21: &usize;
1820
let mut _22: &&usize;
19-
let mut _23: &&usize;
21+
let mut _23: bool;
2022
let mut _24: &&usize;
23+
let _25: &usize;
24+
let mut _26: &&usize;
2125
scope 1 {
22-
debug a => _13;
23-
debug b => _14;
24-
debug c => _15;
25-
debug d => _16;
26+
debug a => _4;
27+
debug b => _5;
28+
debug c => _6;
29+
debug d => _7;
2630
scope 2 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
27-
debug self => _17;
28-
debug other => _18;
31+
debug self => _8;
32+
debug other => _10;
2933
scope 3 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
30-
debug self => _13;
31-
debug other => _15;
32-
let mut _4: usize;
33-
let mut _5: usize;
34+
debug self => _4;
35+
debug other => _6;
36+
let mut _11: usize;
37+
let mut _12: usize;
3438
}
3539
}
3640
scope 4 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
37-
debug self => _19;
38-
debug other => _20;
41+
debug self => _14;
42+
debug other => _16;
3943
scope 5 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
40-
debug self => _16;
41-
debug other => _14;
42-
let mut _7: usize;
43-
let mut _8: usize;
44+
debug self => _7;
45+
debug other => _5;
46+
let mut _17: usize;
47+
let mut _18: usize;
4448
}
4549
}
4650
scope 6 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
47-
debug self => _21;
51+
debug self => _20;
4852
debug other => _22;
4953
scope 7 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
50-
debug self => _15;
51-
debug other => _13;
54+
debug self => _6;
55+
debug other => _4;
5256
}
5357
}
5458
scope 8 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
55-
debug self => _23;
56-
debug other => _24;
59+
debug self => _24;
60+
debug other => _26;
5761
scope 9 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
58-
debug self => _14;
59-
debug other => _16;
60-
let mut _11: usize;
61-
let mut _12: usize;
62+
debug self => _5;
63+
debug other => _7;
64+
let mut _27: usize;
65+
let mut _28: usize;
6266
}
6367
}
6468
}
6569

6670
bb0: {
71+
StorageLive(_4);
6772
_3 = copy (*_2);
68-
// DBG: _13 = &((*_3).0: usize);
69-
// DBG: _14 = &((*_3).1: usize);
70-
// DBG: _15 = &((*_3).2: usize);
71-
// DBG: _16 = &((*_3).3: usize);
73+
_4 = &((*_3).0: usize);
74+
StorageLive(_5);
75+
_5 = &((*_3).1: usize);
7276
StorageLive(_6);
73-
// DBG: _17 = &_13;
74-
// DBG: _18 = &?;
75-
_4 = copy ((*_3).0: usize);
76-
_5 = copy ((*_3).2: usize);
77-
_6 = Le(copy _4, copy _5);
78-
switchInt(move _6) -> [0: bb2, otherwise: bb1];
77+
_6 = &((*_3).2: usize);
78+
StorageLive(_7);
79+
_7 = &((*_3).3: usize);
80+
StorageLive(_13);
81+
StorageLive(_8);
82+
_8 = &_4;
83+
StorageLive(_10);
84+
StorageLive(_9);
85+
_9 = copy _6;
86+
_10 = &_9;
87+
_11 = copy ((*_3).0: usize);
88+
_12 = copy ((*_3).2: usize);
89+
_13 = Le(copy _11, copy _12);
90+
switchInt(move _13) -> [0: bb1, otherwise: bb2];
7991
}
8092

8193
bb1: {
82-
StorageLive(_9);
83-
// DBG: _19 = &_16;
84-
// DBG: _20 = &?;
85-
StorageLive(_7);
86-
_7 = copy ((*_3).3: usize);
87-
StorageLive(_8);
88-
_8 = copy ((*_3).1: usize);
89-
_9 = Le(move _7, move _8);
94+
StorageDead(_9);
95+
StorageDead(_10);
9096
StorageDead(_8);
91-
StorageDead(_7);
92-
switchInt(move _9) -> [0: bb2, otherwise: bb6];
97+
goto -> bb4;
9398
}
9499

95100
bb2: {
96-
StorageLive(_10);
97-
// DBG: _21 = &_15;
98-
// DBG: _22 = &?;
99-
_10 = Le(copy _5, copy _4);
100-
switchInt(move _10) -> [0: bb3, otherwise: bb4];
101+
StorageDead(_9);
102+
StorageDead(_10);
103+
StorageDead(_8);
104+
StorageLive(_19);
105+
StorageLive(_14);
106+
_14 = &_7;
107+
StorageLive(_16);
108+
StorageLive(_15);
109+
_15 = copy _5;
110+
_16 = &_15;
111+
StorageLive(_17);
112+
_17 = copy ((*_3).3: usize);
113+
StorageLive(_18);
114+
_18 = copy ((*_3).1: usize);
115+
_19 = Le(move _17, move _18);
116+
StorageDead(_18);
117+
StorageDead(_17);
118+
switchInt(move _19) -> [0: bb3, otherwise: bb8];
101119
}
102120

103121
bb3: {
104-
_0 = const false;
105-
goto -> bb5;
122+
StorageDead(_15);
123+
StorageDead(_16);
124+
StorageDead(_14);
125+
goto -> bb4;
106126
}
107127

108128
bb4: {
109-
// DBG: _23 = &_14;
110-
// DBG: _24 = &?;
111-
StorageLive(_11);
112-
_11 = copy ((*_3).1: usize);
113-
StorageLive(_12);
114-
_12 = copy ((*_3).3: usize);
115-
_0 = Le(move _11, move _12);
116-
StorageDead(_12);
117-
StorageDead(_11);
118-
goto -> bb5;
129+
StorageLive(_23);
130+
StorageLive(_20);
131+
_20 = &_6;
132+
StorageLive(_22);
133+
StorageLive(_21);
134+
_21 = copy _4;
135+
_22 = &_21;
136+
_23 = Le(copy _12, copy _11);
137+
switchInt(move _23) -> [0: bb5, otherwise: bb6];
119138
}
120139

121140
bb5: {
122-
StorageDead(_10);
141+
StorageDead(_21);
142+
StorageDead(_22);
143+
StorageDead(_20);
144+
_0 = const false;
123145
goto -> bb7;
124146
}
125147

126148
bb6: {
127-
_0 = const true;
149+
StorageDead(_21);
150+
StorageDead(_22);
151+
StorageDead(_20);
152+
StorageLive(_24);
153+
_24 = &_5;
154+
StorageLive(_26);
155+
StorageLive(_25);
156+
_25 = copy _7;
157+
_26 = &_25;
158+
StorageLive(_27);
159+
_27 = copy ((*_3).1: usize);
160+
StorageLive(_28);
161+
_28 = copy ((*_3).3: usize);
162+
_0 = Le(move _27, move _28);
163+
StorageDead(_28);
164+
StorageDead(_27);
165+
StorageDead(_25);
166+
StorageDead(_26);
167+
StorageDead(_24);
128168
goto -> bb7;
129169
}
130170

131171
bb7: {
132-
StorageDead(_9);
172+
StorageDead(_23);
173+
goto -> bb9;
174+
}
175+
176+
bb8: {
177+
StorageDead(_15);
178+
StorageDead(_16);
179+
StorageDead(_14);
180+
_0 = const true;
181+
goto -> bb9;
182+
}
183+
184+
bb9: {
185+
StorageDead(_19);
186+
StorageDead(_13);
187+
StorageDead(_7);
133188
StorageDead(_6);
189+
StorageDead(_5);
190+
StorageDead(_4);
134191
return;
135192
}
136193
}

0 commit comments

Comments
 (0)