about summary refs log tree commit diff
path: root/tests/mir-opt/simplify_aggregate_to_copy_miscompile.foo.GVN.diff
blob: 54c11679f0c69b0f01551b8ace4ad1199a96a722 (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
- // MIR for `foo` before GVN
+ // MIR for `foo` after GVN
  
  fn foo(_1: &mut Option<i32>) -> Option<i32> {
      debug v => _1;
      let mut _0: std::option::Option<i32>;
      let mut _2: &std::option::Option<i32>;
      let mut _3: &std::option::Option<i32>;
      let mut _4: isize;
      let mut _6: !;
      let mut _7: std::option::Option<i32>;
      let mut _8: i32;
      let mut _9: !;
      scope 1 {
          debug col => _5;
          let _5: i32;
      }
  
      bb0: {
          StorageLive(_2);
          StorageLive(_3);
          _3 = &(*_1);
          _2 = get::<Option<i32>>(move _3) -> [return: bb1, unwind unreachable];
      }
  
      bb1: {
          StorageDead(_3);
          _4 = discriminant((*_2));
          switchInt(move _4) -> [1: bb2, otherwise: bb3];
      }
  
      bb2: {
-         StorageLive(_5);
+         nop;
          _5 = copy (((*_2) as Some).0: i32);
          StorageLive(_7);
-         _7 = Option::<i32>::None;
-         (*_1) = move _7;
+         _7 = const Option::<i32>::None;
+         (*_1) = const Option::<i32>::None;
          StorageDead(_7);
          StorageLive(_8);
          _8 = copy _5;
-         _0 = Option::<i32>::Some(move _8);
+         _0 = Option::<i32>::Some(copy _5);
          StorageDead(_8);
-         StorageDead(_5);
+         nop;
          StorageDead(_2);
          return;
      }
  
      bb3: {
          StorageLive(_9);
          unreachable;
      }
+ }
+ 
+ ALLOC0 (size: 8, align: 4) {
+     00 00 00 00 __ __ __ __                         │ ....░░░░
  }