summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff
blob: 97d0a01e00bc4fd725769dfb1cc601b264026b22 (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
127
128
129
130
131
132
133
134
135
136
137
138
- // MIR for `main` before CopyProp
+ // MIR for `main` after CopyProp
  
  fn main() -> () {
      let mut _0: ();                      // return place in scope 0 at $DIR/issue_107511.rs:+0:11: +0:11
      let mut _1: i32;                     // in scope 0 at $DIR/issue_107511.rs:+1:9: +1:16
      let mut _3: std::ops::Range<usize>;  // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
      let mut _4: std::ops::Range<usize>;  // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
      let mut _5: usize;                   // in scope 0 at $DIR/issue_107511.rs:+6:17: +6:24
      let mut _6: &[i32];                  // in scope 0 at $DIR/issue_107511.rs:+6:17: +6:24
      let mut _7: &[i32; 4];               // in scope 0 at $DIR/issue_107511.rs:+6:17: +6:24
      let mut _9: ();                      // in scope 0 at $DIR/issue_107511.rs:+0:1: +9:2
      let _10: ();                         // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
      let mut _11: std::option::Option<usize>; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
      let mut _12: &mut std::ops::Range<usize>; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
      let mut _13: &mut std::ops::Range<usize>; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
      let mut _14: isize;                  // in scope 0 at $DIR/issue_107511.rs:+6:5: +8:6
      let mut _15: !;                      // in scope 0 at $DIR/issue_107511.rs:+6:5: +8:6
      let mut _17: i32;                    // in scope 0 at $DIR/issue_107511.rs:+7:16: +7:20
      let _18: usize;                      // in scope 0 at $DIR/issue_107511.rs:+7:18: +7:19
      let mut _19: usize;                  // in scope 0 at $DIR/issue_107511.rs:+7:16: +7:20
      let mut _20: bool;                   // in scope 0 at $DIR/issue_107511.rs:+7:16: +7:20
      scope 1 {
          debug sum => _1;                 // in scope 1 at $DIR/issue_107511.rs:+1:9: +1:16
          let _2: [i32; 4];                // in scope 1 at $DIR/issue_107511.rs:+2:9: +2:10
          scope 2 {
              debug a => _2;               // in scope 2 at $DIR/issue_107511.rs:+2:9: +2:10
              let mut _8: std::ops::Range<usize>; // in scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
              scope 3 {
                  debug iter => _8;        // in scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
                  let _16: usize;          // in scope 3 at $DIR/issue_107511.rs:+6:9: +6:10
                  scope 4 {
                      debug i => _16;      // in scope 4 at $DIR/issue_107511.rs:+6:9: +6:10
                  }
              }
          }
      }
  
      bb0: {
          StorageLive(_1);                 // scope 0 at $DIR/issue_107511.rs:+1:9: +1:16
          _1 = const 0_i32;                // scope 0 at $DIR/issue_107511.rs:+1:19: +1:20
          StorageLive(_2);                 // scope 1 at $DIR/issue_107511.rs:+2:9: +2:10
          _2 = [const 0_i32, const 10_i32, const 20_i32, const 30_i32]; // scope 1 at $DIR/issue_107511.rs:+2:13: +2:28
          StorageLive(_3);                 // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
          StorageLive(_4);                 // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
          StorageLive(_5);                 // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
          StorageLive(_6);                 // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
          StorageLive(_7);                 // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
          _7 = &_2;                        // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
          _6 = move _7 as &[i32] (Pointer(Unsize)); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
          StorageDead(_7);                 // scope 2 at $DIR/issue_107511.rs:+6:17: +6:18
          _5 = core::slice::<impl [i32]>::len(move _6) -> bb1; // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
                                           // mir::Constant
                                           // + span: $DIR/issue_107511.rs:10:19: 10:22
                                           // + literal: Const { ty: for<'a> fn(&'a [i32]) -> usize {core::slice::<impl [i32]>::len}, val: Value(<ZST>) }
      }
  
      bb1: {
          StorageDead(_6);                 // scope 2 at $DIR/issue_107511.rs:+6:23: +6:24
          _4 = std::ops::Range::<usize> { start: const 0_usize, end: move _5 }; // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
          StorageDead(_5);                 // scope 2 at $DIR/issue_107511.rs:+6:23: +6:24
          _3 = <std::ops::Range<usize> as IntoIterator>::into_iter(move _4) -> bb2; // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
                                           // mir::Constant
                                           // + span: $DIR/issue_107511.rs:10:14: 10:24
                                           // + literal: Const { ty: fn(std::ops::Range<usize>) -> <std::ops::Range<usize> as IntoIterator>::IntoIter {<std::ops::Range<usize> as IntoIterator>::into_iter}, val: Value(<ZST>) }
      }
  
      bb2: {
          StorageDead(_4);                 // scope 2 at $DIR/issue_107511.rs:+6:23: +6:24
          StorageLive(_8);                 // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
          _8 = move _3;                    // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
          goto -> bb3;                     // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6
      }
  
      bb3: {
-         StorageLive(_10);                // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
          StorageLive(_11);                // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
          StorageLive(_12);                // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
          StorageLive(_13);                // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
          _13 = &mut _8;                   // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
          _12 = &mut (*_13);               // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
          _11 = <std::ops::Range<usize> as Iterator>::next(move _12) -> bb4; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
                                           // mir::Constant
                                           // + span: $DIR/issue_107511.rs:10:14: 10:24
                                           // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range<usize>) -> Option<<std::ops::Range<usize> as Iterator>::Item> {<std::ops::Range<usize> as Iterator>::next}, val: Value(<ZST>) }
      }
  
      bb4: {
          StorageDead(_12);                // scope 3 at $DIR/issue_107511.rs:+6:23: +6:24
          _14 = discriminant(_11);         // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
          switchInt(move _14) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
      }
  
      bb5: {
-         StorageLive(_16);                // scope 3 at $DIR/issue_107511.rs:+6:9: +6:10
          _16 = ((_11 as Some).0: usize);  // scope 3 at $DIR/issue_107511.rs:+6:9: +6:10
          StorageLive(_17);                // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
-         StorageLive(_18);                // scope 4 at $DIR/issue_107511.rs:+7:18: +7:19
-         _18 = _16;                       // scope 4 at $DIR/issue_107511.rs:+7:18: +7:19
          _19 = Len(_2);                   // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
-         _20 = Lt(_18, _19);              // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
-         assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _18) -> bb8; // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
+         _20 = Lt(_16, _19);              // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
+         assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> bb8; // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
      }
  
      bb6: {
          unreachable;                     // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
      }
  
      bb7: {
          _0 = const ();                   // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6
          StorageDead(_13);                // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
          StorageDead(_11);                // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
-         StorageDead(_10);                // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
          StorageDead(_8);                 // scope 2 at $DIR/issue_107511.rs:+8:5: +8:6
          StorageDead(_3);                 // scope 2 at $DIR/issue_107511.rs:+8:5: +8:6
          StorageDead(_2);                 // scope 1 at $DIR/issue_107511.rs:+9:1: +9:2
          StorageDead(_1);                 // scope 0 at $DIR/issue_107511.rs:+9:1: +9:2
          return;                          // scope 0 at $DIR/issue_107511.rs:+9:2: +9:2
      }
  
      bb8: {
-         _17 = _2[_18];                   // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
+         _17 = _2[_16];                   // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
          _1 = Add(_1, move _17);          // scope 4 at $DIR/issue_107511.rs:+7:9: +7:20
          StorageDead(_17);                // scope 4 at $DIR/issue_107511.rs:+7:19: +7:20
-         StorageDead(_18);                // scope 4 at $DIR/issue_107511.rs:+7:20: +7:21
-         _10 = const ();                  // scope 4 at $DIR/issue_107511.rs:+6:25: +8:6
-         StorageDead(_16);                // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
          StorageDead(_13);                // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
          StorageDead(_11);                // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
-         StorageDead(_10);                // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
-         _9 = const ();                   // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6
          goto -> bb3;                     // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6
      }
  }