]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/simplify_arm.id_try.SimplifyBranchSame.diff
rustc_mir: properly map scope parent chains into the caller when inlining.
[rust.git] / src / test / mir-opt / simplify_arm.id_try.SimplifyBranchSame.diff
1 - // MIR for `id_try` before SimplifyBranchSame
2 + // MIR for `id_try` after SimplifyBranchSame
3   
4   fn id_try(_1: std::result::Result<u8, i32>) -> std::result::Result<u8, i32> {
5       debug r => _1;                       // in scope 0 at $DIR/simplify-arm.rs:23:11: 23:12
6       let mut _0: std::result::Result<u8, i32>; // return place in scope 0 at $DIR/simplify-arm.rs:23:34: 23:49
7       let _2: u8;                          // in scope 0 at $DIR/simplify-arm.rs:24:9: 24:10
8       let mut _3: std::result::Result<u8, i32>; // in scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
9       let mut _4: std::result::Result<u8, i32>; // in scope 0 at $DIR/simplify-arm.rs:24:13: 24:14
10       let mut _5: isize;                   // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
11       let _6: i32;                         // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
12       let mut _7: !;                       // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
13       let mut _8: i32;                     // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
14       let mut _9: i32;                     // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
15       let _10: u8;                         // in scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
16       let mut _11: u8;                     // in scope 0 at $DIR/simplify-arm.rs:25:8: 25:9
17       scope 1 {
18           debug x => ((_0 as Ok).0: u8);   // in scope 1 at $DIR/simplify-arm.rs:24:9: 24:10
19       }
20       scope 2 {
21           debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify-arm.rs:24:14: 24:15
22           scope 3 {
23               scope 7 (inlined <i32 as From<i32>>::from) { // at $DIR/simplify-arm.rs:24:14: 24:15
24                   debug t => ((_0 as Err).0: i32); // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
25               }
26               scope 8 (inlined <std::result::Result<u8, i32> as Try>::from_error) { // at $DIR/simplify-arm.rs:24:13: 24:15
27                   debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
28                   let mut _12: i32;        // in scope 8 at $DIR/simplify-arm.rs:24:13: 24:15
29               }
30           }
31       }
32       scope 4 {
33           debug val => ((_0 as Ok).0: u8); // in scope 4 at $DIR/simplify-arm.rs:24:13: 24:15
34           scope 5 {
35           }
36       }
37       scope 6 (inlined <std::result::Result<u8, i32> as Try>::into_result) { // at $DIR/simplify-arm.rs:24:13: 24:15
38           debug self => _4;                // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
39       }
40   
41       bb0: {
42           StorageLive(_2);                 // scope 0 at $DIR/simplify-arm.rs:24:9: 24:10
43           StorageLive(_3);                 // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
44           StorageLive(_4);                 // scope 0 at $DIR/simplify-arm.rs:24:13: 24:14
45           _4 = _1;                         // scope 0 at $DIR/simplify-arm.rs:24:13: 24:14
46           _3 = move _4;                    // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
47           StorageDead(_4);                 // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
48           _5 = discriminant(_3);           // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
49 -         switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
50 +         goto -> bb1;                     // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
51       }
52   
53       bb1: {
54           _0 = move _3;                    // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
55           StorageDead(_3);                 // scope 0 at $DIR/simplify-arm.rs:24:15: 24:16
56           StorageDead(_2);                 // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
57 -         goto -> bb4;                     // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
58 +         goto -> bb2;                     // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
59       }
60   
61       bb2: {
62 -         unreachable;                     // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
63 -     }
64
65 -     bb3: {
66 -         _0 = move _3;                    // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
67 -         StorageDead(_3);                 // scope 0 at $DIR/simplify-arm.rs:24:15: 24:16
68 -         StorageDead(_2);                 // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
69 -         goto -> bb4;                     // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
70 -     }
71
72 -     bb4: {
73           return;                          // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
74       }
75   }
76