about summary refs log tree commit diff
path: root/tests/mir-opt/gvn.dereference_indexing.GVN.panic-unwind.diff
blob: f38bc51adc480b24cd7aa8d5cbc95654979a4d15 (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
- // MIR for `dereference_indexing` before GVN
+ // MIR for `dereference_indexing` after GVN
  
  fn dereference_indexing(_1: [u8; 2], _2: usize) -> () {
      debug array => _1;
      debug index => _2;
      let mut _0: ();
      let _3: &u8;
      let _4: usize;
      let mut _5: usize;
      let _6: usize;
      let mut _7: bool;
      let _8: ();
      let mut _9: u8;
      scope 1 {
          debug a => _3;
      }
      scope 2 {
          debug i => _4;
      }
  
      bb0: {
          StorageLive(_3);
-         StorageLive(_4);
+         nop;
          StorageLive(_5);
          _5 = copy _2;
-         _4 = Add(move _5, const 1_usize);
+         _4 = Add(copy _2, const 1_usize);
          StorageDead(_5);
          StorageLive(_6);
          _6 = copy _4;
-         _7 = Lt(copy _6, const 2_usize);
-         assert(move _7, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _6) -> [success: bb1, unwind continue];
+         _7 = Lt(copy _4, const 2_usize);
+         assert(move _7, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _4) -> [success: bb1, unwind continue];
      }
  
      bb1: {
-         _3 = &_1[_6];
-         StorageDead(_4);
+         _3 = &_1[_4];
+         nop;
          StorageLive(_8);
          StorageLive(_9);
          _9 = copy (*_3);
          _8 = opaque::<u8>(move _9) -> [return: bb2, unwind continue];
      }
  
      bb2: {
          StorageDead(_9);
          StorageDead(_8);
          _0 = const ();
          StorageDead(_6);
          StorageDead(_3);
          return;
      }
  }