File: lower_array_len.array_bound.GVN.panic-unwind.diff

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (77 lines) | stat: -rw-r--r-- 1,967 bytes parent folder | download | duplicates (2)
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
- // MIR for `array_bound` before GVN
+ // MIR for `array_bound` after GVN
  
  fn array_bound(_1: usize, _2: &[u8; N]) -> u8 {
      debug index => _1;
      debug slice => _2;
      let mut _0: u8;
      let mut _3: bool;
      let mut _4: usize;
      let mut _5: usize;
      let mut _6: &[u8];
      let mut _7: &[u8; N];
      let _8: usize;
      let mut _9: usize;
      let mut _10: bool;
  
      bb0: {
-         StorageLive(_3);
+         nop;
          StorageLive(_4);
          _4 = copy _1;
-         StorageLive(_5);
+         nop;
          StorageLive(_6);
          StorageLive(_7);
          _7 = &(*_2);
          _6 = move _7 as &[u8] (PointerCoercion(Unsize, Implicit));
          StorageDead(_7);
-         _5 = PtrMetadata(move _6);
+         _5 = const N;
          goto -> bb1;
      }
  
      bb1: {
          StorageDead(_6);
-         _3 = Lt(move _4, move _5);
-         switchInt(move _3) -> [0: bb4, otherwise: bb2];
+         _3 = Lt(copy _1, const N);
+         switchInt(copy _3) -> [0: bb4, otherwise: bb2];
      }
  
      bb2: {
-         StorageDead(_5);
+         nop;
          StorageDead(_4);
          StorageLive(_8);
          _8 = copy _1;
-         _9 = Len((*_2));
-         _10 = Lt(copy _8, copy _9);
-         assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, copy _8) -> [success: bb3, unwind continue];
+         _9 = const N;
+         _10 = copy _3;
+         assert(copy _3, "index out of bounds: the length is {} but the index is {}", const N, copy _1) -> [success: bb3, unwind continue];
      }
  
      bb3: {
-         _0 = copy (*_2)[_8];
+         _0 = copy (*_2)[_1];
          StorageDead(_8);
          goto -> bb5;
      }
  
      bb4: {
-         StorageDead(_5);
+         nop;
          StorageDead(_4);
          _0 = const 42_u8;
          goto -> bb5;
      }
  
      bb5: {
-         StorageDead(_3);
+         nop;
          return;
      }
  }