Skip to content

Commit 0b7141d

Browse files
committed
Default interp.
1 parent b47175e commit 0b7141d

9 files changed

+308
-488
lines changed

tests/coverage/try_error_result.cov-map

Lines changed: 103 additions & 134 deletions
Large diffs are not rendered by default.

tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,12 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
44
debug x => _1;
55
debug n => _2;
66
let mut _0: u32;
7-
scope 1 (inlined <u32 as Step>::forward) {
8-
debug start => _1;
9-
debug n => _2;
10-
let _3: std::option::Option<u32>;
11-
let mut _4: &std::option::Option<u32>;
12-
let mut _7: bool;
13-
let mut _8: u32;
14-
scope 2 {
15-
}
16-
scope 3 (inlined Option::<u32>::is_none) {
17-
debug self => _4;
18-
let mut _6: bool;
19-
scope 4 (inlined Option::<u32>::is_some) {
20-
debug self => _4;
21-
let mut _5: isize;
22-
}
23-
}
24-
scope 5 (inlined core::num::<impl u32>::wrapping_add) {
25-
debug self => _1;
26-
debug rhs => _8;
27-
}
28-
}
297

308
bb0: {
31-
StorageLive(_7);
32-
StorageLive(_4);
33-
StorageLive(_3);
34-
_3 = <u32 as Step>::forward_checked(_1, _2) -> [return: bb1, unwind continue];
9+
_0 = <u32 as Step>::forward(move _1, move _2) -> [return: bb1, unwind continue];
3510
}
3611

3712
bb1: {
38-
_4 = &_3;
39-
StorageLive(_6);
40-
StorageLive(_5);
41-
_5 = discriminant(_3);
42-
_6 = Eq(_5, const 1_isize);
43-
StorageDead(_5);
44-
_7 = Not(move _6);
45-
StorageDead(_6);
46-
switchInt(move _7) -> [0: bb2, otherwise: bb3];
47-
}
48-
49-
bb2: {
50-
StorageDead(_3);
51-
StorageDead(_4);
52-
goto -> bb4;
53-
}
54-
55-
bb3: {
56-
StorageDead(_3);
57-
StorageDead(_4);
58-
assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb4, unwind continue];
59-
}
60-
61-
bb4: {
62-
StorageDead(_7);
63-
StorageLive(_8);
64-
_8 = _2 as u32 (IntToInt);
65-
_0 = Add(_1, _8);
66-
StorageDead(_8);
6713
return;
6814
}
6915
}

tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ fn int_range(_1: usize, _2: usize) -> () {
77
let mut _3: std::ops::Range<usize>;
88
let mut _4: std::ops::Range<usize>;
99
let mut _5: &mut std::ops::Range<usize>;
10-
let mut _11: std::option::Option<usize>;
11-
let mut _12: isize;
12-
let _16: ();
10+
let mut _13: std::option::Option<usize>;
11+
let _15: ();
1312
scope 1 {
1413
debug iter => _4;
15-
let _15: usize;
14+
let _14: usize;
1615
scope 2 {
17-
debug i => _15;
16+
debug i => _14;
1817
}
1918
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
2019
debug self => _5;
@@ -23,10 +22,10 @@ fn int_range(_1: usize, _2: usize) -> () {
2322
let mut _6: &usize;
2423
let mut _7: &usize;
2524
let mut _10: bool;
26-
let _13: usize;
27-
let mut _14: usize;
25+
let _11: usize;
26+
let mut _12: usize;
2827
scope 6 {
29-
debug old => _13;
28+
debug old => _11;
3029
scope 7 {
3130
}
3231
}
@@ -51,9 +50,9 @@ fn int_range(_1: usize, _2: usize) -> () {
5150
}
5251

5352
bb1: {
54-
StorageLive(_11);
55-
_5 = &mut _4;
5653
StorageLive(_13);
54+
_5 = &mut _4;
55+
StorageLive(_11);
5756
StorageLive(_10);
5857
StorageLive(_6);
5958
_6 = &(_4.0: usize);
@@ -66,57 +65,39 @@ fn int_range(_1: usize, _2: usize) -> () {
6665
_10 = Lt(move _8, move _9);
6766
StorageDead(_9);
6867
StorageDead(_8);
69-
switchInt(move _10) -> [0: bb2, otherwise: bb5];
68+
switchInt(move _10) -> [0: bb2, otherwise: bb3];
7069
}
7170

7271
bb2: {
7372
StorageDead(_7);
7473
StorageDead(_6);
75-
_11 = const Option::<usize>::None;
7674
StorageDead(_10);
77-
StorageDead(_13);
78-
_12 = discriminant(_11);
79-
switchInt(move _12) -> [0: bb3, 1: bb7, otherwise: bb4];
80-
}
81-
82-
bb3: {
8375
StorageDead(_11);
76+
StorageDead(_13);
8477
StorageDead(_4);
8578
return;
8679
}
8780

88-
bb4: {
89-
unreachable;
90-
}
91-
92-
bb5: {
81+
bb3: {
9382
StorageDead(_7);
9483
StorageDead(_6);
95-
_13 = (_4.0: usize);
96-
StorageLive(_14);
97-
_14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb6, unwind continue];
84+
_11 = (_4.0: usize);
85+
StorageLive(_12);
86+
_12 = <usize as Step>::forward_unchecked(_11, const 1_usize) -> [return: bb4, unwind continue];
9887
}
9988

100-
bb6: {
101-
(_4.0: usize) = move _14;
102-
StorageDead(_14);
103-
_11 = Option::<usize>::Some(_13);
89+
bb4: {
90+
(_4.0: usize) = move _12;
91+
StorageDead(_12);
92+
_13 = Option::<usize>::Some(_11);
10493
StorageDead(_10);
105-
StorageDead(_13);
106-
goto -> bb7;
107-
}
108-
109-
bb7: {
110-
_15 = ((_11 as Some).0: usize);
111-
_16 = opaque::<usize>(move _15) -> [return: bb8, unwind continue];
94+
StorageDead(_11);
95+
_14 = ((_13 as Some).0: usize);
96+
_15 = opaque::<usize>(move _14) -> [return: bb5, unwind continue];
11297
}
11398

114-
bb8: {
115-
StorageDead(_11);
99+
bb5: {
100+
StorageDead(_13);
116101
goto -> bb1;
117102
}
118103
}
119-
120-
ALLOC0 (size: 16, align: 8) {
121-
00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
122-
}

tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir

Lines changed: 32 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
88
let mut _4: std::ops::Range<u32>;
99
let mut _5: std::ops::Range<u32>;
1010
let mut _6: &mut std::ops::Range<u32>;
11-
let mut _12: std::option::Option<u32>;
12-
let mut _13: isize;
13-
let mut _17: &impl Fn(u32);
14-
let mut _18: (u32,);
15-
let _19: ();
11+
let mut _14: std::option::Option<u32>;
12+
let mut _16: &impl Fn(u32);
13+
let mut _17: (u32,);
14+
let _18: ();
1615
scope 1 {
1716
debug iter => _5;
18-
let _16: u32;
17+
let _15: u32;
1918
scope 2 {
20-
debug x => _16;
19+
debug x => _15;
2120
}
2221
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
2322
debug self => _6;
@@ -26,10 +25,10 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
2625
let mut _7: &u32;
2726
let mut _8: &u32;
2827
let mut _11: bool;
29-
let _14: u32;
30-
let mut _15: u32;
28+
let _12: u32;
29+
let mut _13: u32;
3130
scope 6 {
32-
debug old => _14;
31+
debug old => _12;
3332
scope 7 {
3433
}
3534
}
@@ -54,9 +53,9 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
5453
}
5554

5655
bb1: {
57-
StorageLive(_12);
58-
_6 = &mut _5;
5956
StorageLive(_14);
57+
_6 = &mut _5;
58+
StorageLive(_12);
6059
StorageLive(_11);
6160
StorageLive(_7);
6261
_7 = &(_5.0: u32);
@@ -69,67 +68,49 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
6968
_11 = Lt(move _9, move _10);
7069
StorageDead(_10);
7170
StorageDead(_9);
72-
switchInt(move _11) -> [0: bb2, otherwise: bb6];
71+
switchInt(move _11) -> [0: bb2, otherwise: bb4];
7372
}
7473

7574
bb2: {
7675
StorageDead(_8);
7776
StorageDead(_7);
78-
_12 = const Option::<u32>::None;
7977
StorageDead(_11);
80-
StorageDead(_14);
81-
_13 = discriminant(_12);
82-
switchInt(move _13) -> [0: bb3, 1: bb8, otherwise: bb5];
83-
}
84-
85-
bb3: {
8678
StorageDead(_12);
79+
StorageDead(_14);
8780
StorageDead(_5);
88-
drop(_3) -> [return: bb4, unwind unreachable];
81+
drop(_3) -> [return: bb3, unwind unreachable];
8982
}
9083

91-
bb4: {
84+
bb3: {
9285
return;
9386
}
9487

95-
bb5: {
96-
unreachable;
97-
}
98-
99-
bb6: {
88+
bb4: {
10089
StorageDead(_8);
10190
StorageDead(_7);
102-
_14 = (_5.0: u32);
103-
StorageLive(_15);
104-
_15 = <u32 as Step>::forward_unchecked(_14, const 1_usize) -> [return: bb7, unwind unreachable];
91+
_12 = (_5.0: u32);
92+
StorageLive(_13);
93+
_13 = <u32 as Step>::forward_unchecked(_12, const 1_usize) -> [return: bb5, unwind unreachable];
10594
}
10695

107-
bb7: {
108-
(_5.0: u32) = move _15;
109-
StorageDead(_15);
110-
_12 = Option::<u32>::Some(_14);
96+
bb5: {
97+
(_5.0: u32) = move _13;
98+
StorageDead(_13);
99+
_14 = Option::<u32>::Some(_12);
111100
StorageDead(_11);
112-
StorageDead(_14);
113-
goto -> bb8;
114-
}
115-
116-
bb8: {
117-
_16 = ((_12 as Some).0: u32);
101+
StorageDead(_12);
102+
_15 = ((_14 as Some).0: u32);
103+
StorageLive(_16);
104+
_16 = &_3;
118105
StorageLive(_17);
119-
_17 = &_3;
120-
StorageLive(_18);
121-
_18 = (_16,);
122-
_19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind unreachable];
106+
_17 = (_15,);
107+
_18 = <impl Fn(u32) as Fn<(u32,)>>::call(move _16, move _17) -> [return: bb6, unwind unreachable];
123108
}
124109

125-
bb9: {
126-
StorageDead(_18);
110+
bb6: {
127111
StorageDead(_17);
128-
StorageDead(_12);
112+
StorageDead(_16);
113+
StorageDead(_14);
129114
goto -> bb1;
130115
}
131116
}
132-
133-
ALLOC0 (size: 8, align: 4) {
134-
00 00 00 00 __ __ __ __ │ ....░░░░
135-
}

0 commit comments

Comments
 (0)