Skip to content

Commit 9366dfd

Browse files
committed
Bless 32bit MIR opt tests
1 parent fd5b40f commit 9366dfd

6 files changed

+72
-97
lines changed

compiler/rustc_mir_build/src/build/expr/into.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
106106
ExprKind::Let { expr, ref pat } => {
107107
let scope = this.local_scope();
108108
let (true_block, false_block) = this.in_if_then_scope(scope, |this| {
109-
this.lower_let_else(block, &this.thir[expr], pat, scope, expr_span)
109+
this.lower_let_expr(block, &this.thir[expr], pat, scope, expr_span)
110110
});
111111

112112
let join_block = this.cfg.start_new_block();

compiler/rustc_mir_build/src/build/matches/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
6060
})
6161
}
6262
ExprKind::Let { expr, ref pat } => {
63-
this.lower_let_else(block, &this.thir[expr], pat, break_scope, variable_scope_span)
63+
this.lower_let_expr(block, &this.thir[expr], pat, break_scope, variable_scope_span)
6464
}
6565
_ => {
6666
let mutability = Mutability::Mut;
@@ -1754,7 +1754,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
17541754
// Pat binding - used for `let` and function parameters as well.
17551755

17561756
impl<'a, 'tcx> Builder<'a, 'tcx> {
1757-
crate fn lower_let_else(
1757+
crate fn lower_let_expr(
17581758
&mut self,
17591759
mut block: BasicBlock,
17601760
expr: &Expr<'tcx>,
@@ -1962,7 +1962,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
19621962
Guard::IfLet(ref pat, scrutinee) => {
19631963
let s = &this.thir[scrutinee];
19641964
guard_span = s.span;
1965-
this.lower_let_else(block, s, pat, match_scope, arm_span)
1965+
this.lower_let_expr(block, s, pat, match_scope, arm_span)
19661966
}
19671967
});
19681968

src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@
1818
((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44
1919
discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44
2020
- _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31
21-
- switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
21+
- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
2222
+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
23-
+ switchInt(const 1_isize) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
23+
+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
2424
}
2525

2626
bb1: {
27-
_2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:11:59: 11:61
28-
goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64
27+
switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
2928
}
3029

3130
bb2: {
32-
switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
31+
_2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49
32+
goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64
3333
}
3434

3535
bb3: {
36-
_2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49
36+
_2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:11:59: 11:61
3737
goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64
3838
}
3939

src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff

+37-62
Original file line numberDiff line numberDiff line change
@@ -4,105 +4,80 @@
44
fn match_nested_if() -> bool {
55
let mut _0: bool; // return place in scope 0 at $DIR/matches_reduce_branches.rs:39:25: 39:29
66
let _1: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:40:9: 40:12
7-
let mut _2: (); // in scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:23
8-
let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
9-
let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
10-
let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
11-
let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
12-
+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
13-
+ let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
14-
+ let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
15-
+ let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
7+
let mut _2: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
8+
let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
9+
let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
10+
+ let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
11+
+ let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
12+
+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
1613
scope 1 {
1714
debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:40:9: 40:12
1815
}
1916

2017
bb0: {
2118
StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:40:9: 40:12
22-
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:23
23-
StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
24-
StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
25-
StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
26-
StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
27-
_6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
28-
- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
19+
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
20+
StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
21+
StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
22+
_4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
23+
- switchInt(move _4) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
2924
- }
3025
-
3126
- bb1: {
32-
- _5 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:31: 41:35
27+
- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:31: 41:35
3328
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
3429
- }
3530
-
3631
- bb2: {
37-
- _5 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50
32+
- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50
3833
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
3934
- }
4035
-
4136
- bb3: {
42-
+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
43-
+ _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
44-
+ _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50
45-
+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
46-
StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52
47-
- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
37+
+ StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
38+
+ _5 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
39+
+ _3 = Ne(_5, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50
40+
+ StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
41+
StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52
42+
- switchInt(move _3) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
4843
- }
4944
-
5045
- bb4: {
51-
- _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:55: 41:59
46+
- _2 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:55: 41:59
5247
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
5348
- }
5449
-
5550
- bb5: {
56-
- _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74
51+
- _2 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74
5752
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
5853
- }
5954
-
6055
- bb6: {
61-
+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
62-
+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
63-
+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74
64-
+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
65-
StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:75: 41:76
66-
- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
56+
+ StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
57+
+ _6 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
58+
+ _2 = Ne(_6, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74
59+
+ StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
60+
StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:75: 41:76
61+
- switchInt(move _2) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
6762
- }
6863
-
6964
- bb7: {
70-
- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:42:13: 42:17
71-
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
72-
- }
73-
-
74-
- bb8: {
75-
- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:44:13: 44:18
76-
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
77-
- }
78-
-
79-
- bb9: {
80-
+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
81-
+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
82-
+ _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:44:13: 44:18
83-
+ StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
84-
StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10
85-
- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
86-
- }
87-
-
88-
- bb10: {
89-
+ StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
90-
+ _10 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
91-
StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10
65+
+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
66+
+ _7 = move _2; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
67+
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10
9268
- _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17
93-
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17
69+
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10
9470
- }
9571
-
96-
- bb11: {
97-
- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10
72+
- bb8: {
73+
- StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10
9874
- _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
99-
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
75+
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
10076
- }
10177
-
102-
- bb12: {
103-
+ _1 = Ne(_10, const false); // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
104-
+ StorageDead(_10); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
105-
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:50:6: 50:7
78+
- bb9: {
79+
+ _1 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
80+
+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
10681
_0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:51:5: 51:8
10782
StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:52:1: 52:2
10883
return; // scope 0 at $DIR/matches_reduce_branches.rs:52:2: 52:2

src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir

+15-15
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
| '_#1r | Local | ['_#1r]
66
|
77
| Inferred Region Values
8-
| '_#0r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0], '_#0r, '_#1r}
9-
| '_#1r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0], '_#1r}
8+
| '_#0r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#0r, '_#1r}
9+
| '_#1r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#1r}
1010
| '_#2r | U0 | {}
1111
| '_#3r | U0 | {bb1[0..=7], bb2[0..=2]}
1212
| '_#4r | U0 | {bb1[1..=7], bb2[0..=2]}
1313
| '_#5r | U0 | {bb1[4..=7], bb2[0..=2]}
1414
|
1515
| Inference Constraints
16-
| '_#0r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0]}
17-
| '_#1r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0]}
16+
| '_#0r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]}
17+
| '_#1r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]}
1818
| '_#3r live at {bb1[0]}
1919
| '_#4r live at {bb1[1..=3]}
2020
| '_#5r live at {bb1[4..=7], bb2[0..=2]}
@@ -63,32 +63,32 @@ fn main() -> () {
6363
FakeRead(ForLet(None), _6); // bb1[4]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10
6464
StorageLive(_7); // bb1[5]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12
6565
_7 = const Const(Value(Scalar(0x01)): bool); // bb1[6]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12
66-
switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb3, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6
66+
switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12
6767
}
6868

6969
bb2: {
7070
StorageLive(_8); // bb2[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
7171
StorageLive(_9); // bb2[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17
7272
_9 = (*_6); // bb2[2]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17
73-
_8 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb4, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
73+
_8 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
7474
// mir::Constant
7575
// + span: $DIR/region-subtyping-basic.rs:21:9: 21:14
7676
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
7777
}
7878

7979
bb3: {
80-
StorageLive(_10); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18
81-
_10 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x00000016)): usize)) -> [return: bb5, unwind: bb7]; // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18
82-
// mir::Constant
83-
// + span: $DIR/region-subtyping-basic.rs:23:9: 23:14
84-
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
80+
StorageDead(_9); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18
81+
StorageDead(_8); // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19
82+
_0 = const Const(Value(Scalar(<ZST>)): ()); // bb3[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6
83+
goto -> bb6; // bb3[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6
8584
}
8685

8786
bb4: {
88-
StorageDead(_9); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18
89-
StorageDead(_8); // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19
90-
_0 = const Const(Value(Scalar(<ZST>)): ()); // bb4[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6
91-
goto -> bb6; // bb4[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6
87+
StorageLive(_10); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18
88+
_10 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x00000016)): usize)) -> [return: bb5, unwind: bb7]; // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18
89+
// mir::Constant
90+
// + span: $DIR/region-subtyping-basic.rs:23:9: 23:14
91+
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
9292
}
9393

9494
bb5: {

0 commit comments

Comments
 (0)