Skip to content

Commit eae208e

Browse files
authored
Rollup merge of #110732 - cjgillot:unit-const-prop, r=tmiasko
Make ConstProp some tests unit. Part of the effort to tidy up mir-opt test suite.
2 parents 5dec8df + baa1312 commit eae208e

19 files changed

+79
-75
lines changed

tests/mir-opt/const_prop/mult_by_zero.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// unit-test
2-
// compile-flags: -O -Zmir-opt-level=4
1+
// unit-test: ConstProp
32

43
// EMIT_MIR mult_by_zero.test.ConstProp.diff
54
fn test(x : i32) -> i32 {

tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
let mut _2: i32; // in scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4
88

99
bb0: {
10-
- _0 = Mul(_1, const 0_i32); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8
10+
StorageLive(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4
11+
_2 = _1; // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4
12+
- _0 = Mul(move _2, const 0_i32); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8
1113
+ _0 = const 0_i32; // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8
14+
StorageDead(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:7: +1:8
1215
return; // scope 0 at $DIR/mult_by_zero.rs:+2:2: +2:2
1316
}
1417
}

tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
StorageLive(_2); // scope 1 at $DIR/mutable_variable.rs:+3:9: +3:10
2020
- _2 = _1; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14
2121
+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14
22+
_0 = const (); // scope 0 at $DIR/mutable_variable.rs:+0:11: +4:2
2223
StorageDead(_2); // scope 1 at $DIR/mutable_variable.rs:+4:1: +4:2
2324
StorageDead(_1); // scope 0 at $DIR/mutable_variable.rs:+4:1: +4:2
2425
return; // scope 0 at $DIR/mutable_variable.rs:+4:2: +4:2

tests/mir-opt/const_prop/mutable_variable.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// unit-test
2-
// compile-flags: -O
1+
// unit-test: ConstProp
32

43
// EMIT_MIR mutable_variable.main.ConstProp.diff
54
fn main() {

tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,26 @@
33

44
fn main() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +0:11
6-
let mut _3: i32; // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
7-
let mut _4: i32; // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
6+
let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
87
scope 1 {
9-
debug x => (i32, i32){ .0 => _3, .1 => _4, }; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
10-
let _1: i32; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
11-
let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
8+
debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
9+
let _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
1210
scope 2 {
13-
debug y => (i32, i32){ .0 => _3, .1 => _2, }; // in scope 2 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
11+
debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
1412
}
1513
}
1614

1715
bb0: {
18-
StorageLive(_4); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
19-
_3 = const 42_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
20-
_4 = const 43_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
21-
_4 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+2:5: +2:13
16+
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
17+
- _1 = (const 42_i32, const 43_i32); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
18+
+ _1 = const (42_i32, 43_i32); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
19+
(_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+2:5: +2:13
2220
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
23-
- _2 = _4; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
24-
+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
21+
- _2 = _1; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
22+
+ _2 = const (42_i32, 99_i32); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
23+
_0 = const (); // scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +4:2
2524
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2
26-
StorageDead(_4); // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2
25+
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2
2726
return; // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:2: +4:2
2827
}
2928
}

tests/mir-opt/const_prop/mutable_variable_aggregate.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// unit-test
2-
// compile-flags: -O
1+
// unit-test: ConstProp
32

43
// EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff
54
fn main() {

tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
let _2: &mut (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10
1010
scope 2 {
1111
debug z => _2; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10
12-
let _3: i32; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
13-
let _4: i32; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
12+
let _3: (i32, i32); // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
1413
scope 3 {
15-
debug y => (i32, i32){ .0 => _3, .1 => _4, }; // in scope 3 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
14+
debug y => _3; // in scope 3 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
1615
}
1716
}
1817
}
@@ -24,11 +23,9 @@
2423
_2 = &mut _1; // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:13: +2:19
2524
((*_2).1: i32) = const 99_i32; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+3:5: +3:13
2625
StorageLive(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
27-
StorageLive(_4); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
28-
_3 = (_1.0: i32); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14
29-
_4 = (_1.1: i32); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14
26+
_3 = _1; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14
27+
_0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+0:11: +5:2
3028
StorageDead(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
31-
StorageDead(_4); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
3229
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
3330
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
3431
return; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:2: +5:2

tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// unit-test
2-
// compile-flags: -O
1+
// unit-test: ConstProp
32

43
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff
54
fn main() {

tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
1717
_1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:29: +1:34
1818
// mir::Constant
19-
// + span: $DIR/mutable_variable_aggregate_partial_read.rs:7:29: 7:32
19+
// + span: $DIR/mutable_variable_aggregate_partial_read.rs:6:29: 6:32
2020
// + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value(<ZST>) }
2121
}
2222

@@ -26,6 +26,7 @@
2626
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
2727
- _2 = (_1.1: i32); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16
2828
+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16
29+
_0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +5:2
2930
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2
3031
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2
3132
return; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:2: +5:2

tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// ignore-wasm32 compiled with panic=abort by default
2-
// unit-test
3-
// compile-flags: -O
2+
// unit-test: ConstProp
43

54
// EMIT_MIR mutable_variable_aggregate_partial_read.main.ConstProp.diff
65
fn main() {

0 commit comments

Comments
 (0)