1
1
//@ test-mir-pass: SimplifyCfg-final
2
- //@ compile-flags: -Zmir-enable-passes=+DeadStoreElimination-initial,+SimplifyConstCondition-final
2
+ //@ compile-flags: -Zmir-enable-passes=+DeadStoreElimination-initial
3
3
4
4
#![ feature( core_intrinsics, custom_mir) ]
5
5
#![ crate_type = "lib" ]
@@ -13,7 +13,7 @@ pub struct Foo {
13
13
}
14
14
15
15
// EMIT_MIR simplifycfg.drop_debuginfo.SimplifyCfg-final.diff
16
- #[ custom_mir( dialect = "runtime" ) ]
16
+ #[ custom_mir( dialect = "runtime" , phase = "post-cleanup" ) ]
17
17
pub fn drop_debuginfo ( foo : & Foo , c : bool ) -> i32 {
18
18
// CHECK-LABEL: fn drop_debuginfo
19
19
// CHECK: debug foo_b => [[foo_b:_[0-9]+]];
@@ -46,7 +46,7 @@ pub fn drop_debuginfo(foo: &Foo, c: bool) -> i32 {
46
46
}
47
47
48
48
// EMIT_MIR simplifycfg.preserve_debuginfo_1.SimplifyCfg-final.diff
49
- #[ custom_mir( dialect = "runtime" ) ]
49
+ #[ custom_mir( dialect = "runtime" , phase = "post-cleanup" ) ]
50
50
pub fn preserve_debuginfo_1 ( foo : & Foo , v : & mut bool ) -> i32 {
51
51
// CHECK-LABEL: fn preserve_debuginfo_1
52
52
// CHECK: debug foo_a => [[foo_a:_[0-9]+]];
@@ -67,10 +67,7 @@ pub fn preserve_debuginfo_1(foo: &Foo, v: &mut bool) -> i32 {
67
67
debug foo_b => _foo_b;
68
68
debug foo_c => _foo_c;
69
69
{
70
- match true {
71
- true => tmp,
72
- _ => ret,
73
- }
70
+ Goto ( tmp)
74
71
}
75
72
tmp = {
76
73
* v = true ;
@@ -87,7 +84,7 @@ pub fn preserve_debuginfo_1(foo: &Foo, v: &mut bool) -> i32 {
87
84
}
88
85
89
86
// EMIT_MIR simplifycfg.preserve_debuginfo_2.SimplifyCfg-final.diff
90
- #[ custom_mir( dialect = "runtime" ) ]
87
+ #[ custom_mir( dialect = "runtime" , phase = "post-cleanup" ) ]
91
88
pub fn preserve_debuginfo_2 ( foo : & Foo ) -> i32 {
92
89
// CHECK-LABEL: fn preserve_debuginfo_2
93
90
// CHECK: debug foo_a => [[foo_a:_[0-9]+]];
@@ -107,9 +104,45 @@ pub fn preserve_debuginfo_2(foo: &Foo) -> i32 {
107
104
debug foo_b => _foo_b;
108
105
debug foo_c => _foo_c;
109
106
{
110
- match true {
107
+ Goto ( tmp)
108
+ }
109
+ tmp = {
110
+ _foo_a = & ( * foo) . a;
111
+ Goto ( ret)
112
+ }
113
+ ret = {
114
+ _foo_b = & ( * foo) . b;
115
+ RET = ( * foo) . c;
116
+ _foo_c = & ( * foo) . c;
117
+ Return ( )
118
+ }
119
+ }
120
+ }
121
+
122
+ // EMIT_MIR simplifycfg.preserve_debuginfo_identical_succs.SimplifyCfg-final.diff
123
+ #[ custom_mir( dialect = "runtime" , phase = "post-cleanup" ) ]
124
+ pub fn preserve_debuginfo_identical_succs ( foo : & Foo , c : bool ) -> i32 {
125
+ // CHECK-LABEL: fn preserve_debuginfo_identical_succs
126
+ // CHECK: debug foo_a => [[foo_a:_[0-9]+]];
127
+ // CHECK: debug foo_b => [[foo_b:_[0-9]+]];
128
+ // CHECK: debug foo_c => [[foo_c:_[0-9]+]];
129
+ // CHECK: bb0: {
130
+ // CHECK-NEXT: DBG: [[foo_a]] = &((*_1).0: i32)
131
+ // CHECK-NEXT: DBG: [[foo_b]] = &((*_1).1: i64)
132
+ // CHECK-NEXT: _0 = copy ((*_1).2: i32);
133
+ // CHECK-NEXT: DBG: [[foo_c]] = &((*_1).2: i32)
134
+ // CHECK-NEXT: return;
135
+ mir ! {
136
+ let _foo_a: & i32 ;
137
+ let _foo_b: & i64 ;
138
+ let _foo_c: & i32 ;
139
+ debug foo_a => _foo_a;
140
+ debug foo_b => _foo_b;
141
+ debug foo_c => _foo_c;
142
+ {
143
+ match c {
111
144
true => tmp,
112
- _ => ret ,
145
+ _ => tmp ,
113
146
}
114
147
}
115
148
tmp = {
0 commit comments