Bless 32bit MIR opt tests

This commit is contained in:
Matthew Jasper 2021-09-02 10:18:08 +01:00
parent fd5b40fd3e
commit 9366dfdff5
6 changed files with 74 additions and 99 deletions

View File

@ -106,7 +106,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
ExprKind::Let { expr, ref pat } => {
let scope = this.local_scope();
let (true_block, false_block) = this.in_if_then_scope(scope, |this| {
this.lower_let_else(block, &this.thir[expr], pat, scope, expr_span)
this.lower_let_expr(block, &this.thir[expr], pat, scope, expr_span)
});
let join_block = this.cfg.start_new_block();

View File

@ -60,7 +60,7 @@ pub(crate) fn then_else_break(
})
}
ExprKind::Let { expr, ref pat } => {
this.lower_let_else(block, &this.thir[expr], pat, break_scope, variable_scope_span)
this.lower_let_expr(block, &this.thir[expr], pat, break_scope, variable_scope_span)
}
_ => {
let mutability = Mutability::Mut;
@ -1754,7 +1754,7 @@ fn calculate_fake_borrows<'b>(
// Pat binding - used for `let` and function parameters as well.
impl<'a, 'tcx> Builder<'a, 'tcx> {
crate fn lower_let_else(
crate fn lower_let_expr(
&mut self,
mut block: BasicBlock,
expr: &Expr<'tcx>,
@ -1962,7 +1962,7 @@ fn bind_and_guard_matched_candidate<'pat>(
Guard::IfLet(ref pat, scrutinee) => {
let s = &this.thir[scrutinee];
guard_span = s.span;
this.lower_let_else(block, s, pat, match_scope, arm_span)
this.lower_let_expr(block, s, pat, match_scope, arm_span)
}
});

View File

@ -18,22 +18,22 @@
((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44
discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44
- _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31
- switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
+ switchInt(const 1_isize) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
}
bb1: {
_2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:11:59: 11:61
goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64
switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
}
bb2: {
switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31
_2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49
goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64
}
bb3: {
_2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49
_2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:11:59: 11:61
goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64
}

View File

@ -4,105 +4,80 @@
fn match_nested_if() -> bool {
let mut _0: bool; // return place in scope 0 at $DIR/matches_reduce_branches.rs:39:25: 39:29
let _1: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:40:9: 40:12
let mut _2: (); // in scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:23
let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
+ let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
+ let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
+ let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
let mut _2: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
+ let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
+ let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
scope 1 {
debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:40:9: 40:12
}
bb0: {
StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:40:9: 40:12
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:23
StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
_6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
_4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
- switchInt(move _4) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
- }
-
- bb1: {
- _5 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:31: 41:35
- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:31: 41:35
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
- }
-
- bb2: {
- _5 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50
- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
- }
-
- bb3: {
+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
+ _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
+ _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50
+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52
- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
+ StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
+ _5 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
+ _3 = Ne(_5, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50
+ StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28
StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52
- switchInt(move _3) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
- }
-
- bb4: {
- _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:55: 41:59
- _2 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:55: 41:59
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
- }
-
- bb5: {
- _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74
- _2 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
- }
-
- bb6: {
+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74
+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:75: 41:76
- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
+ StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
+ _6 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
+ _2 = Ne(_6, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74
+ StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52
StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:75: 41:76
- switchInt(move _2) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
- }
-
- bb7: {
- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:42:13: 42:17
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
+ _7 = move _2; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10
- _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10
- }
-
- bb8: {
- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:44:13: 44:18
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
- StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10
- _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
- }
-
- bb9: {
+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
+ _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:44:13: 44:18
+ StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10
- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
- }
-
- bb10: {
+ StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
+ _10 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10
- _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17
- }
-
- bb11: {
- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10
- _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
- }
-
- bb12: {
+ _1 = Ne(_10, const false); // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
+ StorageDead(_10); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:50:6: 50:7
+ _1 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19
+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76
_0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:51:5: 51:8
StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:52:1: 52:2
return; // scope 0 at $DIR/matches_reduce_branches.rs:52:2: 52:2

View File

@ -5,16 +5,16 @@
| '_#1r | Local | ['_#1r]
|
| Inferred Region Values
| '_#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}
| '_#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}
| '_#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}
| '_#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}
| '_#2r | U0 | {}
| '_#3r | U0 | {bb1[0..=7], bb2[0..=2]}
| '_#4r | U0 | {bb1[1..=7], bb2[0..=2]}
| '_#5r | U0 | {bb1[4..=7], bb2[0..=2]}
|
| Inference Constraints
| '_#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]}
| '_#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]}
| '_#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]}
| '_#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]}
| '_#3r live at {bb1[0]}
| '_#4r live at {bb1[1..=3]}
| '_#5r live at {bb1[4..=7], bb2[0..=2]}
@ -63,32 +63,32 @@ fn main() -> () {
FakeRead(ForLet(None), _6); // bb1[4]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10
StorageLive(_7); // bb1[5]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12
_7 = const Const(Value(Scalar(0x01)): bool); // bb1[6]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12
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
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
}
bb2: {
StorageLive(_8); // bb2[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18
StorageLive(_9); // bb2[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17
_9 = (*_6); // bb2[2]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17
_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
_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
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:21:9: 21:14
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
}
bb3: {
StorageLive(_10); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18
_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
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:23:9: 23:14
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
StorageDead(_9); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18
StorageDead(_8); // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19
_0 = const Const(Value(Scalar(<ZST>)): ()); // bb3[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6
goto -> bb6; // bb3[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6
}
bb4: {
StorageDead(_9); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18
StorageDead(_8); // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19
_0 = const Const(Value(Scalar(<ZST>)): ()); // bb4[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6
goto -> bb6; // bb4[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6
StorageLive(_10); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18
_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
// mir::Constant
// + span: $DIR/region-subtyping-basic.rs:23:9: 23:14
// + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) }
}
bb5: {

View File

@ -21,28 +21,28 @@
StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32
discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32
- _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25
- switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25
- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25
+ _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25
+ switchInt(const 0_isize) -> [1_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25
+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25
}
bb1: {
switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25
}
bb2: {
_1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15
nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14
goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14
}
bb3: {
StorageLive(_7); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
nop; // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
StorageDead(_7); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6
goto -> bb4; // scope 1 at no-location
}
bb2: {
switchInt(((_3 as Some).0: u32)) -> [0_u32: bb3, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25
}
bb3: {
_1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15
nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14
goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14
}
bb4: {
StorageDead(_3); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6
StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2