Skip to content

Commit b542c55

Browse files
committed
Bless mir-opt tests.
1 parent c535326 commit b542c55

16 files changed

+531
-362
lines changed

tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
let mut _2: std::option::Option<T>;
88
+ scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
99
+ debug self => _2;
10-
+ let mut _3: isize;
10+
+ let mut _3: &std::option::Option<T>;
11+
+ let mut _4: isize;
1112
+ scope 2 {
1213
+ debug val => _0;
1314
+ }
@@ -20,16 +21,17 @@
2021
+ }
2122
+ }
2223
+ scope 4 (inlined Option::<T>::is_some) {
23-
+ debug self => &_2;
24+
+ debug self => _3;
2425
+ }
2526
+ }
2627

2728
bb0: {
2829
StorageLive(_2);
2930
_2 = move _1;
3031
- _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind unreachable];
31-
+ _3 = discriminant(_2);
32-
+ switchInt(move _3) -> [1: bb2, otherwise: bb1];
32+
+ StorageLive(_3);
33+
+ _4 = discriminant(_2);
34+
+ switchInt(move _4) -> [1: bb2, otherwise: bb1];
3335
}
3436

3537
bb1: {
@@ -38,6 +40,7 @@
3840
+
3941
+ bb2: {
4042
+ _0 = move ((_2 as Some).0: T);
43+
+ StorageDead(_3);
4144
StorageDead(_2);
4245
return;
4346
}

tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
let mut _2: std::option::Option<T>;
88
+ scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
99
+ debug self => _2;
10-
+ let mut _3: isize;
10+
+ let mut _3: &std::option::Option<T>;
11+
+ let mut _4: isize;
1112
+ scope 2 {
1213
+ debug val => _0;
1314
+ }
@@ -20,16 +21,17 @@
2021
+ }
2122
+ }
2223
+ scope 4 (inlined Option::<T>::is_some) {
23-
+ debug self => &_2;
24+
+ debug self => _3;
2425
+ }
2526
+ }
2627

2728
bb0: {
2829
StorageLive(_2);
2930
_2 = move _1;
3031
- _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2];
31-
+ _3 = discriminant(_2);
32-
+ switchInt(move _3) -> [1: bb2, otherwise: bb1];
32+
+ StorageLive(_3);
33+
+ _4 = discriminant(_2);
34+
+ switchInt(move _4) -> [1: bb2, otherwise: bb1];
3335
}
3436

3537
bb1: {
@@ -42,6 +44,7 @@
4244
- resume;
4345
+ bb2: {
4446
+ _0 = move ((_2 as Some).0: T);
47+
+ StorageDead(_3);
4548
+ StorageDead(_2);
4649
+ return;
4750
}

tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
66
scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
77
debug self => _1;
88
let mut _2: isize;
9+
let mut _3: &std::option::Option<T>;
910
scope 2 {
1011
debug val => _0;
1112
}
@@ -18,17 +19,19 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
1819
}
1920
}
2021
scope 4 (inlined Option::<T>::is_some) {
21-
debug self => &_1;
22+
debug self => _3;
2223
}
2324
}
2425

2526
bb0: {
27+
StorageLive(_3);
2628
_2 = discriminant(_1);
2729
switchInt(move _2) -> [1: bb1, otherwise: bb2];
2830
}
2931

3032
bb1: {
3133
_0 = move ((_1 as Some).0: T);
34+
StorageDead(_3);
3235
return;
3336
}
3437

tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
66
scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
77
debug self => _1;
88
let mut _2: isize;
9+
let mut _3: &std::option::Option<T>;
910
scope 2 {
1011
debug val => _0;
1112
}
@@ -18,17 +19,19 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
1819
}
1920
}
2021
scope 4 (inlined Option::<T>::is_some) {
21-
debug self => &_1;
22+
debug self => _3;
2223
}
2324
}
2425

2526
bb0: {
27+
StorageLive(_3);
2628
_2 = discriminant(_1);
2729
switchInt(move _2) -> [1: bb1, otherwise: bb2];
2830
}
2931

3032
bb1: {
3133
_0 = move ((_1 as Some).0: T);
34+
StorageDead(_3);
3235
return;
3336
}
3437

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
1010
let _3: std::option::Option<u32>;
1111
let mut _6: bool;
1212
let mut _7: u32;
13+
let mut _8: &std::option::Option<u32>;
1314
scope 2 {
1415
}
1516
scope 3 (inlined Option::<u32>::is_none) {
16-
debug self => &_3;
17+
debug self => _8;
1718
let mut _5: bool;
1819
scope 4 (inlined Option::<u32>::is_some) {
19-
debug self => &_3;
20+
debug self => _8;
2021
let mut _4: isize;
2122
}
2223
}
@@ -28,6 +29,7 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
2829

2930
bb0: {
3031
StorageLive(_6);
32+
StorageLive(_8);
3133
StorageLive(_3);
3234
_3 = <u32 as Step>::forward_checked(_1, _2) -> [return: bb1, unwind continue];
3335
}
@@ -39,6 +41,7 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
3941
_6 = Not(move _5);
4042
StorageDead(_5);
4143
StorageDead(_3);
44+
StorageDead(_8);
4245
switchInt(move _6) -> [0: bb3, otherwise: bb2];
4346
}
4447

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
1010
let mut _8: std::option::Option<U>;
1111
let mut _9: isize;
1212
let _11: ();
13+
let mut _12: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
1314
scope 1 {
1415
debug iter => _5;
1516
let _10: U;
1617
scope 2 {
1718
debug x => _10;
1819
}
1920
scope 4 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as Iterator>::next) {
20-
debug self => &_5;
21+
debug self => _12;
2122
let mut _6: &mut impl Iterator<Item = T>;
2223
let mut _7: &mut impl Fn(T) -> Option<U>;
2324
}

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

+53-40
Original file line numberDiff line numberDiff line change
@@ -4,95 +4,108 @@ fn int_range(_1: usize, _2: usize) -> () {
44
debug start => _1;
55
debug end => _2;
66
let mut _0: ();
7-
let mut _3: usize;
8-
let mut _6: std::option::Option<usize>;
9-
let mut _9: isize;
10-
let _11: ();
7+
let mut _3: std::ops::Range<usize>;
8+
let mut _4: std::ops::Range<usize>;
9+
let mut _8: std::option::Option<usize>;
10+
let mut _11: isize;
11+
let _13: ();
12+
let mut _14: &mut std::ops::Range<usize>;
1113
scope 1 {
12-
debug iter => std::ops::Range<usize>{ .0 => _3, .1 => _2, };
13-
let _10: usize;
14+
debug iter => _4;
15+
let _12: usize;
1416
scope 2 {
15-
debug i => _10;
17+
debug i => _12;
1618
}
1719
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
18-
debug self => &std::ops::Range<usize>{ .0 => _3, .1 => _2, };
20+
debug self => _14;
1921
scope 5 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
20-
debug self => &std::ops::Range<usize>{ .0 => _3, .1 => _2, };
21-
let mut _5: bool;
22-
let _7: usize;
23-
let mut _8: usize;
22+
debug self => _14;
23+
let mut _7: bool;
24+
let _9: usize;
25+
let mut _10: usize;
26+
let mut _15: &usize;
27+
let mut _16: &usize;
2428
scope 6 {
25-
debug old => _7;
29+
debug old => _9;
2630
scope 7 {
2731
}
2832
}
2933
scope 8 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
30-
debug self => &_3;
31-
debug other => &_2;
32-
let mut _4: usize;
34+
debug self => _15;
35+
debug other => _16;
36+
let mut _5: usize;
37+
let mut _6: usize;
3338
}
3439
}
3540
}
3641
}
3742
scope 3 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
38-
debug self => std::ops::Range<usize>{ .0 => _1, .1 => _2, };
43+
debug self => _3;
3944
}
4045

4146
bb0: {
42-
StorageLive(_3);
43-
_3 = _1;
47+
_3 = std::ops::Range::<usize> { start: _1, end: _2 };
48+
StorageLive(_4);
49+
_4 = move _3;
4450
goto -> bb1;
4551
}
4652

4753
bb1: {
48-
StorageLive(_6);
54+
StorageLive(_8);
55+
StorageLive(_9);
4956
StorageLive(_7);
57+
StorageLive(_15);
58+
StorageLive(_16);
5059
StorageLive(_5);
51-
StorageLive(_4);
52-
_4 = _3;
53-
_5 = Lt(move _4, _2);
54-
StorageDead(_4);
55-
switchInt(move _5) -> [0: bb2, otherwise: bb3];
60+
_5 = (_4.0: usize);
61+
StorageLive(_6);
62+
_6 = (_4.1: usize);
63+
_7 = Lt(move _5, move _6);
64+
StorageDead(_6);
65+
StorageDead(_5);
66+
StorageDead(_16);
67+
StorageDead(_15);
68+
switchInt(move _7) -> [0: bb2, otherwise: bb3];
5669
}
5770

5871
bb2: {
59-
_6 = Option::<usize>::None;
72+
_8 = Option::<usize>::None;
6073
goto -> bb5;
6174
}
6275

6376
bb3: {
64-
_7 = _3;
65-
StorageLive(_8);
66-
_8 = <usize as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb4, unwind continue];
77+
_9 = (_4.0: usize);
78+
StorageLive(_10);
79+
_10 = <usize as Step>::forward_unchecked(_9, const 1_usize) -> [return: bb4, unwind continue];
6780
}
6881

6982
bb4: {
70-
_3 = move _8;
71-
StorageDead(_8);
72-
_6 = Option::<usize>::Some(_7);
83+
(_4.0: usize) = move _10;
84+
StorageDead(_10);
85+
_8 = Option::<usize>::Some(_9);
7386
goto -> bb5;
7487
}
7588

7689
bb5: {
77-
StorageDead(_5);
7890
StorageDead(_7);
79-
_9 = discriminant(_6);
80-
switchInt(move _9) -> [0: bb6, 1: bb7, otherwise: bb9];
91+
StorageDead(_9);
92+
_11 = discriminant(_8);
93+
switchInt(move _11) -> [0: bb6, 1: bb7, otherwise: bb9];
8194
}
8295

8396
bb6: {
84-
StorageDead(_6);
85-
StorageDead(_3);
97+
StorageDead(_8);
98+
StorageDead(_4);
8699
return;
87100
}
88101

89102
bb7: {
90-
_10 = ((_6 as Some).0: usize);
91-
_11 = opaque::<usize>(move _10) -> [return: bb8, unwind continue];
103+
_12 = ((_8 as Some).0: usize);
104+
_13 = opaque::<usize>(move _12) -> [return: bb8, unwind continue];
92105
}
93106

94107
bb8: {
95-
StorageDead(_6);
108+
StorageDead(_8);
96109
goto -> bb1;
97110
}
98111

0 commit comments

Comments
 (0)