summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
blob: cfcd43093c079c9dd1c62f933802ad14daed2aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
- // MIR for `identity` before SeparateConstSwitch
+ // MIR for `identity` after SeparateConstSwitch
  
  fn identity(_1: Result<i32, i32>) -> Result<i32, i32> {
      debug x => _1;                       // in scope 0 at $DIR/separate_const_switch.rs:+0:13: +0:14
      let mut _0: std::result::Result<i32, i32>; // return place in scope 0 at $DIR/separate_const_switch.rs:+0:37: +0:53
      let mut _2: i32;                     // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
      let mut _3: std::ops::ControlFlow<std::result::Result<std::convert::Infallible, i32>, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
      let mut _4: std::result::Result<i32, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
      let mut _5: isize;                   // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
      let _6: std::result::Result<std::convert::Infallible, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
      let mut _7: !;                       // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
      let mut _8: std::result::Result<std::convert::Infallible, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
      let _9: i32;                         // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
      let mut _16: i32;                    // in scope 0 at $SRC_DIR/core/src/result.rs:LL:COL
      scope 1 {
          debug residual => _6;            // in scope 1 at $DIR/separate_const_switch.rs:+1:9: +1:10
          scope 2 {
              scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) { // at $DIR/separate_const_switch.rs:25:8: 25:10
                  debug residual => _8;    // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
                  let _14: i32;            // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
                  let mut _15: i32;        // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
                  scope 9 {
                      debug e => _14;      // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
                      scope 10 (inlined <i32 as From<i32>>::from) { // at $SRC_DIR/core/src/result.rs:LL:COL
                          debug t => _16;  // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
                      }
                  }
              }
          }
      }
      scope 3 {
          debug val => _9;                 // in scope 3 at $DIR/separate_const_switch.rs:+1:8: +1:10
          scope 4 {
          }
      }
      scope 5 (inlined <Result<i32, i32> as Try>::branch) { // at $DIR/separate_const_switch.rs:25:8: 25:10
          debug self => _4;                // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
          let mut _10: isize;              // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
          let _11: i32;                    // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
          let _12: i32;                    // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
          let mut _13: std::result::Result<std::convert::Infallible, i32>; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
          scope 6 {
              debug v => _11;              // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
          }
          scope 7 {
              debug e => _12;              // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
          }
      }
  
      bb0: {
          StorageLive(_2);                 // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
          StorageLive(_3);                 // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
          StorageLive(_4);                 // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
          _4 = _1;                         // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
          StorageLive(_11);                // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
          StorageLive(_12);                // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
          _10 = discriminant(_4);          // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
          switchInt(move _10) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
      }
  
      bb1: {
          StorageDead(_12);                // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
          StorageDead(_11);                // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
          StorageDead(_4);                 // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
          _5 = discriminant(_3);           // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
          switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
      }
  
      bb2: {
          StorageLive(_9);                 // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
          _9 = ((_3 as Continue).0: i32);  // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
          _2 = _9;                         // scope 4 at $DIR/separate_const_switch.rs:+1:8: +1:10
          StorageDead(_9);                 // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
          _0 = Result::<i32, i32>::Ok(move _2); // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11
          StorageDead(_2);                 // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11
          StorageDead(_3);                 // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2
          return;                          // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2
      }
  
      bb3: {
          unreachable;                     // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
      }
  
      bb4: {
          StorageLive(_6);                 // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
          _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
          StorageLive(_8);                 // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
          _8 = _6;                         // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
          StorageLive(_14);                // scope 2 at $DIR/separate_const_switch.rs:+1:8: +1:10
          _14 = move ((_8 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
          StorageLive(_15);                // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
          StorageLive(_16);                // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
          _16 = move _14;                  // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
          _15 = move _16;                  // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
          StorageDead(_16);                // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
          _0 = Result::<i32, i32>::Err(move _15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
          StorageDead(_15);                // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
          StorageDead(_14);                // scope 2 at $DIR/separate_const_switch.rs:+1:8: +1:10
          StorageDead(_8);                 // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
          StorageDead(_6);                 // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
          StorageDead(_2);                 // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11
          StorageDead(_3);                 // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2
          return;                          // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2
      }
  
      bb5: {
          _12 = move ((_4 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
          StorageLive(_13);                // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
          _13 = Result::<Infallible, i32>::Err(move _12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
          _3 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _13); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
          StorageDead(_13);                // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
          goto -> bb1;                     // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
      }
  
      bb6: {
          unreachable;                     // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
      }
  
      bb7: {
          _11 = move ((_4 as Ok).0: i32);  // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
          _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _11); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
          goto -> bb1;                     // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
      }
  }