]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/inst_combine_deref.do_not_miscompile.InstCombine.diff
Run the test with explicit -O such that Add is generated instead of CheckedAdd
[rust.git] / src / test / mir-opt / inst_combine_deref.do_not_miscompile.InstCombine.diff
1 - // MIR for `do_not_miscompile` before InstCombine
2 + // MIR for `do_not_miscompile` after InstCombine
3   
4   fn do_not_miscompile() -> () {
5       let mut _0: ();                      // return place in scope 0 at $DIR/inst_combine_deref.rs:54:24: 54:24
6       let _1: i32;                         // in scope 0 at $DIR/inst_combine_deref.rs:55:9: 55:10
7       let mut _5: &i32;                    // in scope 0 at $DIR/inst_combine_deref.rs:59:10: 59:12
8       let _6: &i32;                        // in scope 0 at $DIR/inst_combine_deref.rs:59:10: 59:12
9       let _7: ();                          // in scope 0 at $DIR/inst_combine_deref.rs:60:5: 60:23
10       let mut _8: bool;                    // in scope 0 at $DIR/inst_combine_deref.rs:60:5: 60:23
11       let mut _9: bool;                    // in scope 0 at $DIR/inst_combine_deref.rs:60:13: 60:21
12       let mut _10: i32;                    // in scope 0 at $DIR/inst_combine_deref.rs:60:13: 60:15
13       let mut _11: !;                      // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
14       scope 1 {
15           debug x => _1;                   // in scope 1 at $DIR/inst_combine_deref.rs:55:9: 55:10
16           let _2: i32;                     // in scope 1 at $DIR/inst_combine_deref.rs:56:9: 56:10
17           scope 2 {
18               debug a => _2;               // in scope 2 at $DIR/inst_combine_deref.rs:56:9: 56:10
19               let mut _3: &i32;            // in scope 2 at $DIR/inst_combine_deref.rs:57:9: 57:14
20               scope 3 {
21                   debug y => _3;           // in scope 3 at $DIR/inst_combine_deref.rs:57:9: 57:14
22                   let _4: &mut &i32;       // in scope 3 at $DIR/inst_combine_deref.rs:58:9: 58:10
23                   scope 4 {
24                       debug z => _4;       // in scope 4 at $DIR/inst_combine_deref.rs:58:9: 58:10
25                   }
26               }
27           }
28       }
29   
30       bb0: {
31           StorageLive(_1);                 // scope 0 at $DIR/inst_combine_deref.rs:55:9: 55:10
32           _1 = const 42_i32;               // scope 0 at $DIR/inst_combine_deref.rs:55:13: 55:15
33           StorageLive(_2);                 // scope 1 at $DIR/inst_combine_deref.rs:56:9: 56:10
34           _2 = const 99_i32;               // scope 1 at $DIR/inst_combine_deref.rs:56:13: 56:15
35           StorageLive(_3);                 // scope 2 at $DIR/inst_combine_deref.rs:57:9: 57:14
36           _3 = &_1;                        // scope 2 at $DIR/inst_combine_deref.rs:57:17: 57:19
37           StorageLive(_4);                 // scope 3 at $DIR/inst_combine_deref.rs:58:9: 58:10
38           _4 = &mut _3;                    // scope 3 at $DIR/inst_combine_deref.rs:58:13: 58:19
39           StorageLive(_5);                 // scope 4 at $DIR/inst_combine_deref.rs:59:10: 59:12
40           StorageLive(_6);                 // scope 4 at $DIR/inst_combine_deref.rs:59:10: 59:12
41           _6 = &_2;                        // scope 4 at $DIR/inst_combine_deref.rs:59:10: 59:12
42 -         _5 = &(*_6);                     // scope 4 at $DIR/inst_combine_deref.rs:59:10: 59:12
43 +         _5 = _6;                         // scope 4 at $DIR/inst_combine_deref.rs:59:10: 59:12
44           (*_4) = move _5;                 // scope 4 at $DIR/inst_combine_deref.rs:59:5: 59:12
45           StorageDead(_5);                 // scope 4 at $DIR/inst_combine_deref.rs:59:11: 59:12
46           StorageDead(_6);                 // scope 4 at $DIR/inst_combine_deref.rs:59:12: 59:13
47           StorageLive(_7);                 // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23
48           StorageLive(_8);                 // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23
49           StorageLive(_9);                 // scope 4 at $DIR/inst_combine_deref.rs:60:13: 60:21
50           StorageLive(_10);                // scope 4 at $DIR/inst_combine_deref.rs:60:13: 60:15
51           _10 = (*_3);                     // scope 4 at $DIR/inst_combine_deref.rs:60:13: 60:15
52           _9 = Eq(move _10, const 99_i32); // scope 4 at $DIR/inst_combine_deref.rs:60:13: 60:21
53           StorageDead(_10);                // scope 4 at $DIR/inst_combine_deref.rs:60:20: 60:21
54           _8 = Not(move _9);               // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23
55           StorageDead(_9);                 // scope 4 at $DIR/inst_combine_deref.rs:60:22: 60:23
56           switchInt(_8) -> [false: bb1, otherwise: bb2]; // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23
57       }
58   
59       bb1: {
60           _7 = const ();                   // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23
61           StorageDead(_8);                 // scope 4 at $DIR/inst_combine_deref.rs:60:22: 60:23
62           StorageDead(_7);                 // scope 4 at $DIR/inst_combine_deref.rs:60:22: 60:23
63           _0 = const ();                   // scope 0 at $DIR/inst_combine_deref.rs:54:24: 61:2
64           StorageDead(_4);                 // scope 3 at $DIR/inst_combine_deref.rs:61:1: 61:2
65           StorageDead(_3);                 // scope 2 at $DIR/inst_combine_deref.rs:61:1: 61:2
66           StorageDead(_2);                 // scope 1 at $DIR/inst_combine_deref.rs:61:1: 61:2
67           StorageDead(_1);                 // scope 0 at $DIR/inst_combine_deref.rs:61:1: 61:2
68           return;                          // scope 0 at $DIR/inst_combine_deref.rs:61:2: 61:2
69       }
70   
71       bb2: {
72           StorageLive(_11);                // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
73           begin_panic::<&str>(const "assertion failed: *y == 99"); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
74                                            // mir::Constant
75                                            // + span: $SRC_DIR/std/src/macros.rs:LL:COL
76                                            // + literal: Const { ty: fn(&str) -> ! {std::rt::begin_panic::<&str>}, val: Value(Scalar(<ZST>)) }
77                                            // ty::Const
78                                            // + ty: &str
79                                            // + val: Value(Slice { data: Allocation { bytes: [97, 115, 115, 101, 114, 116, 105, 111, 110, 32, 102, 97, 105, 108, 101, 100, 58, 32, 42, 121, 32, 61, 61, 32, 57, 57], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [67108863], len: Size { raw: 26 } }, size: Size { raw: 26 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 26 })
80                                            // mir::Constant
81                                            // + span: $DIR/inst_combine_deref.rs:1:1: 1:1
82                                            // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [97, 115, 115, 101, 114, 116, 105, 111, 110, 32, 102, 97, 105, 108, 101, 100, 58, 32, 42, 121, 32, 61, 61, 32, 57, 57], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [67108863], len: Size { raw: 26 } }, size: Size { raw: 26 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 26 }) }
83       }
84   }
85