summaryrefslogtreecommitdiffstats
path: root/src/test/mir-opt/derefer_complex_case.main.Derefer.diff
blob: c353c375aa963378b784df57f999431538b6741a (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
- // MIR for `main` before Derefer
+ // MIR for `main` after Derefer
  
  fn main() -> () {
      let mut _0: ();                      // return place in scope 0 at $DIR/derefer_complex_case.rs:+0:11: +0:11
      let mut _1: std::slice::Iter<i32>;   // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
      let mut _2: &[i32; 2];               // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
      let _3: [i32; 2];                    // in scope 0 at $DIR/derefer_complex_case.rs:+1:18: +1:26
      let mut _4: std::slice::Iter<i32>;   // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
      let mut _5: ();                      // in scope 0 at $DIR/derefer_complex_case.rs:+0:1: +2:2
      let _6: ();                          // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
      let mut _7: std::option::Option<&i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
      let mut _8: &mut std::slice::Iter<i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
      let mut _9: &mut std::slice::Iter<i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
      let mut _10: isize;                  // in scope 0 at $DIR/derefer_complex_case.rs:+1:5: +1:40
      let mut _11: !;                      // in scope 0 at $DIR/derefer_complex_case.rs:+1:5: +1:40
      let mut _13: i32;                    // in scope 0 at $DIR/derefer_complex_case.rs:+1:34: +1:37
      let mut _14: &[i32; 2];              // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
+     let mut _15: &i32;                   // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
      scope 1 {
          debug iter => _4;                // in scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          let _12: i32;                    // in scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13
          scope 2 {
              debug foo => _12;            // in scope 2 at $DIR/derefer_complex_case.rs:+1:10: +1:13
          }
      }
  
      bb0: {
          StorageLive(_1);                 // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          StorageLive(_2);                 // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          _14 = const _;                   // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
                                           // mir::Constant
                                           // + span: $DIR/derefer_complex_case.rs:6:17: 6:26
                                           // + literal: Const { ty: &[i32; 2], val: Unevaluated(main, [], Some(promoted[0])) }
          _2 = &(*_14);                    // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          _1 = <&[i32; 2] as IntoIterator>::into_iter(move _2) -> bb1; // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
                                           // mir::Constant
                                           // + span: $DIR/derefer_complex_case.rs:6:17: 6:26
                                           // + literal: Const { ty: fn(&[i32; 2]) -> <&[i32; 2] as IntoIterator>::IntoIter {<&[i32; 2] as IntoIterator>::into_iter}, val: Value(<ZST>) }
      }
  
      bb1: {
          StorageDead(_2);                 // scope 0 at $DIR/derefer_complex_case.rs:+1:25: +1:26
          StorageLive(_4);                 // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          _4 = move _1;                    // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          goto -> bb2;                     // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40
      }
  
      bb2: {
          StorageLive(_6);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          StorageLive(_7);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          StorageLive(_8);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          StorageLive(_9);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          _9 = &mut _4;                    // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          _8 = &mut (*_9);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          _7 = <std::slice::Iter<i32> as Iterator>::next(move _8) -> bb3; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
                                           // mir::Constant
                                           // + span: $DIR/derefer_complex_case.rs:6:17: 6:26
                                           // + literal: Const { ty: for<'r> fn(&'r mut std::slice::Iter<i32>) -> Option<<std::slice::Iter<i32> as Iterator>::Item> {<std::slice::Iter<i32> as Iterator>::next}, val: Value(<ZST>) }
      }
  
      bb3: {
          StorageDead(_8);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:25: +1:26
          _10 = discriminant(_7);          // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
          switchInt(move _10) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
      }
  
      bb4: {
          StorageLive(_12);                // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13
-         _12 = (*((_7 as Some).0: &i32)); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13
+         _15 = deref_copy ((_7 as Some).0: &i32); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13
+         _12 = (*_15);                    // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13
          StorageLive(_13);                // scope 2 at $DIR/derefer_complex_case.rs:+1:34: +1:37
          _13 = _12;                       // scope 2 at $DIR/derefer_complex_case.rs:+1:34: +1:37
          _6 = std::mem::drop::<i32>(move _13) -> bb7; // scope 2 at $DIR/derefer_complex_case.rs:+1:29: +1:38
                                           // mir::Constant
                                           // + span: $DIR/derefer_complex_case.rs:6:29: 6:33
                                           // + literal: Const { ty: fn(i32) {std::mem::drop::<i32>}, val: Value(<ZST>) }
      }
  
      bb5: {
          unreachable;                     // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
      }
  
      bb6: {
          _0 = const ();                   // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40
          StorageDead(_9);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
          StorageDead(_7);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
          StorageDead(_6);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
          StorageDead(_4);                 // scope 0 at $DIR/derefer_complex_case.rs:+1:39: +1:40
          StorageDead(_1);                 // scope 0 at $DIR/derefer_complex_case.rs:+1:39: +1:40
          return;                          // scope 0 at $DIR/derefer_complex_case.rs:+2:2: +2:2
      }
  
      bb7: {
          StorageDead(_13);                // scope 2 at $DIR/derefer_complex_case.rs:+1:37: +1:38
          StorageDead(_12);                // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
          StorageDead(_9);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
          StorageDead(_7);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
          StorageDead(_6);                 // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
          _5 = const ();                   // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40
          goto -> bb2;                     // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40
      }
  }