File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ - // MIR for `f_dead` before GVN
2
+ + // MIR for `f_dead` after GVN
3
+
4
+ fn f_dead(_1: u32) -> () {
5
+ let mut _0: ();
6
+ let mut _2: S;
7
+ let mut _3: S;
8
+
9
+ bb0: {
10
+ - StorageLive(_2);
11
+ + nop;
12
+ _2 = S(copy _1, const 2_u32);
13
+ - StorageDead(_2);
14
+ + nop;
15
+ StorageLive(_3);
16
+ - _3 = S(copy _1, const 2_u32);
17
+ + _3 = copy _2;
18
+ StorageDead(_3);
19
+ return;
20
+ }
21
+ }
22
+
Original file line number Diff line number Diff line change 2
2
//@ test-mir-pass: GVN
3
3
// EMIT_MIR gvn_storage_issue_141649.f.GVN.diff
4
4
// EMIT_MIR gvn_storage_issue_141649.f_borrowed.GVN.diff
5
+ // EMIT_MIR gvn_storage_issue_141649.f_dead.GVN.diff
5
6
6
7
#![ feature( custom_mir, core_intrinsics) ]
7
8
@@ -57,3 +58,26 @@ pub fn f_borrowed(_1: u32) {
57
58
}
58
59
}
59
60
}
61
+
62
+ #[ custom_mir( dialect = "runtime" ) ]
63
+ pub fn f_dead ( _1 : u32 ) {
64
+ // CHECK-LABEL: fn f_dead(
65
+ mir ! {
66
+ let _2: S ;
67
+ let _3: S ;
68
+ {
69
+ // CHECK-NOT: StorageLive(_2);
70
+ // CHECK: StorageLive(_3);
71
+ // CHECK: _3 = copy _2;
72
+ // CHECK: StorageDead(_3);
73
+ // CHECK-NOT: StorageDead(_2);
74
+ StorageLive ( _2) ;
75
+ _2 = S ( _1, 2 ) ;
76
+ StorageDead ( _2) ;
77
+ StorageLive ( _3) ;
78
+ _3 = S ( _1, 2 ) ;
79
+ StorageDead ( _3) ;
80
+ Return ( )
81
+ }
82
+ }
83
+ }
You can’t perform that action at this time.
0 commit comments