Skip to content

Commit afe3d46

Browse files
committed
Update the tests after the change to copy_prop in #143509
1 parent 3404964 commit afe3d46

7 files changed

+40
-28
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/copy-prop/issue_141649.f_head_borrowed.CopyProp.diff

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
bb0: {
1313
StorageLive(_1);
1414
_1 = S(const 1_u32, const 2_u32);
15-
- StorageLive(_2);
15+
StorageLive(_2);
1616
_4 = &_1;
17-
- _2 = copy _1;
18-
- _3 = opaque::<S>(move _1) -> [return: bb1, unwind unreachable];
19-
+ _3 = opaque::<S>(copy _1) -> [return: bb1, unwind unreachable];
17+
_2 = copy _1;
18+
_3 = opaque::<S>(move _1) -> [return: bb1, unwind unreachable];
2019
}
2120

2221
bb1: {
23-
- StorageDead(_2);
22+
StorageDead(_2);
2423
StorageDead(_1);
2524
_5 = opaque::<&S>(move _4) -> [return: bb2, unwind unreachable];
2625
}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ fn f_head_borrowed() {
4747
let _5: &S;
4848
{
4949
// CHECK: StorageLive(_1);
50-
// CHECK-NOT: StorageLive(_2);
51-
// CHECK: _3 = opaque::<S>(copy _1) -> [return: bb1, unwind unreachable];
50+
// FIXME: Currently, copy propagation will not unify borrowed locals.
51+
// If it does, the storage statements for `_2` should be remove
52+
// so these checks will need to be updated.
53+
// CHECK: StorageLive(_2);
54+
// CHECK: _3 = opaque::<S>(move _1) -> [return: bb1, unwind unreachable];
5255
StorageLive(_1);
5356
_1 = S(1, 2);
5457
StorageLive(_2);
@@ -57,7 +60,7 @@ fn f_head_borrowed() {
5760
Call(_3 = opaque(Move(_1)), ReturnTo(bb1), UnwindUnreachable())
5861
}
5962
bb1 = {
60-
// CHECK-NOT: StorageDead(_2);
63+
// CHECK: StorageDead(_2);
6164
// CHECK: StorageDead(_1);
6265
StorageDead(_2);
6366
StorageDead(_1);

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,14 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
7676
}
7777

7878
bb0: {
79+
StorageLive(_4);
7980
_3 = copy (*_2);
8081
_4 = &((*_3).0: usize);
82+
StorageLive(_5);
8183
_5 = &((*_3).1: usize);
84+
StorageLive(_6);
8285
_6 = &((*_3).2: usize);
86+
StorageLive(_7);
8387
_7 = &((*_3).3: usize);
8488
StorageLive(_15);
8589
StorageLive(_8);
@@ -212,6 +216,10 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
212216
bb9: {
213217
StorageDead(_23);
214218
StorageDead(_15);
219+
StorageDead(_7);
220+
StorageDead(_6);
221+
StorageDead(_5);
222+
StorageDead(_4);
215223
return;
216224
}
217225
}

0 commit comments

Comments
 (0)