File tree Expand file tree Collapse file tree 6 files changed +160
-0
lines changed Expand file tree Collapse file tree 6 files changed +160
-0
lines changed Original file line number Diff line number Diff line change 1+ //@ known-bug: #147485
2+ //@ compile-flags: -g -O
3+
4+ #![ crate_type = "lib" ]
5+
6+ pub fn foo ( a : bool , b : bool ) -> bool {
7+ let mut c = & a;
8+ if false {
9+ return * c;
10+ }
11+ let d = b && a;
12+ if d {
13+ c = & b;
14+ }
15+ b
16+ }
Original file line number Diff line number Diff line change 1+ //@ known-bug: #147485
2+ //@ compile-flags: -g -O
3+
4+ #![ crate_type = "lib" ]
5+
6+ pub fn f ( x : * const usize ) -> & ' static usize {
7+ let mut a = unsafe { & * x } ;
8+ a = unsafe { & * x } ;
9+ a
10+ }
11+
12+ pub fn g ( ) {
13+ f ( & 0 ) ;
14+ }
Original file line number Diff line number Diff line change 1+ - // MIR for `remap_debuginfo_locals` before DestinationPropagation
2+ + // MIR for `remap_debuginfo_locals` after DestinationPropagation
3+
4+ fn remap_debuginfo_locals(_1: bool, _2: &bool) -> &bool {
5+ - debug c => _3;
6+ + debug c => _2;
7+ let mut _0: &bool;
8+ let mut _3: &bool;
9+ let mut _4: bool;
10+
11+ bb0: {
12+ // DBG: _3 = &_1;
13+ - StorageLive(_4);
14+ - _4 = copy _1;
15+ - _3 = copy _2;
16+ - switchInt(copy _4) -> [1: bb1, otherwise: bb2];
17+ + nop;
18+ + nop;
19+ + nop;
20+ + switchInt(copy _1) -> [1: bb1, otherwise: bb2];
21+ }
22+
23+ bb1: {
24+ goto -> bb2;
25+ }
26+
27+ bb2: {
28+ - StorageDead(_4);
29+ - _0 = copy _3;
30+ + nop;
31+ + _0 = copy _2;
32+ return;
33+ }
34+ }
35+
Original file line number Diff line number Diff line change 1+ // skip-filecheck
2+ //@ test-mir-pass: DestinationPropagation
3+ //@ compile-flags: -g -Zmir-enable-passes=+DeadStoreElimination-initial
4+
5+ #![ feature( core_intrinsics, custom_mir) ]
6+ #![ crate_type = "lib" ]
7+
8+ use std:: intrinsics:: mir:: * ;
9+
10+ // EMIT_MIR dest_prop.remap_debuginfo_locals.DestinationPropagation.diff
11+ #[ custom_mir( dialect = "runtime" , phase = "post-cleanup" ) ]
12+ pub fn remap_debuginfo_locals ( a : bool , b : & bool ) -> & bool {
13+ mir ! {
14+ let _3: & bool ;
15+ let _4: bool ;
16+ debug c => _3;
17+ {
18+ _3 = & a;
19+ StorageLive ( _4) ;
20+ _4 = a;
21+ _3 = b;
22+ match _4 {
23+ true => bb1,
24+ _ => bb2,
25+ }
26+ }
27+ bb1 = {
28+ Goto ( bb2)
29+ }
30+ bb2 = {
31+ StorageDead ( _4) ;
32+ RET = _3;
33+ Return ( )
34+ }
35+ }
36+ }
Original file line number Diff line number Diff line change 1+ - // MIR for `remap_debuginfo_locals` before ReferencePropagation
2+ + // MIR for `remap_debuginfo_locals` after ReferencePropagation
3+
4+ fn remap_debuginfo_locals() -> () {
5+ let mut _0: ();
6+ let _1: &usize;
7+ let mut _2: *const usize;
8+ let _3: &usize;
9+ let _4: usize;
10+ let mut _5: &usize;
11+ scope 1 (inlined foo) {
12+ - debug a => _1;
13+ + debug a => _5;
14+ }
15+
16+ bb0: {
17+ - StorageLive(_1);
18+ - StorageLive(_2);
19+ - StorageLive(_3);
20+ _5 = const remap_debuginfo_locals::promoted[0];
21+ - _3 = &(*_5);
22+ - _2 = &raw const (*_3);
23+ - // DBG: _1 = &(*_2);
24+ - _1 = &(*_2);
25+ - StorageDead(_2);
26+ - StorageDead(_3);
27+ - StorageDead(_1);
28+ + // DBG: _1 = &(*_5);
29+ _0 = const ();
30+ return;
31+ }
32+ }
33+
Original file line number Diff line number Diff line change 1+ // skip-filecheck
2+ //@ test-mir-pass: ReferencePropagation
3+ //@ compile-flags: -g -Zub_checks=false -Zinline-mir -Zmir-enable-passes=+DeadStoreElimination-initial
4+
5+ #![ feature( core_intrinsics, custom_mir) ]
6+ #![ crate_type = "lib" ]
7+
8+ use std:: intrinsics:: mir:: * ;
9+
10+ // EMIT_MIR ref_prop.remap_debuginfo_locals.ReferencePropagation.diff
11+ pub fn remap_debuginfo_locals ( ) {
12+ foo ( & 0 ) ;
13+ }
14+
15+ #[ custom_mir( dialect = "runtime" , phase = "post-cleanup" ) ]
16+ #[ inline]
17+ fn foo ( x : * const usize ) -> & ' static usize {
18+ mir ! {
19+ debug a => RET ;
20+ {
21+ RET = & * x;
22+ RET = & * x;
23+ Return ( )
24+ }
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments