25
25
tcx : TyCtxt < ' tcx > ,
26
26
body : & ' a mir:: Body < ' tcx > ,
27
27
def_id : DefId ,
28
- dead_unwinds : & ' a BitSet < BasicBlock > ,
28
+ dead_unwinds : Option < & ' a BitSet < BasicBlock > > ,
29
29
entry_sets : IndexVec < BasicBlock , BitSet < A :: Idx > > ,
30
30
analysis : A ,
31
31
42
42
tcx : TyCtxt < ' tcx > ,
43
43
body : & ' a mir:: Body < ' tcx > ,
44
44
def_id : DefId ,
45
- dead_unwinds : & ' a BitSet < BasicBlock > ,
46
45
analysis : A ,
47
46
) -> Self {
48
47
let bits_per_block = analysis. bits_per_block ( body) ;
70
69
}
71
70
}
72
71
73
- Self :: new ( tcx, body, def_id, dead_unwinds , analysis, Some ( trans_for_block) )
72
+ Self :: new ( tcx, body, def_id, analysis, Some ( trans_for_block) )
74
73
}
75
74
}
76
75
@@ -87,17 +86,15 @@ where
87
86
tcx : TyCtxt < ' tcx > ,
88
87
body : & ' a mir:: Body < ' tcx > ,
89
88
def_id : DefId ,
90
- dead_unwinds : & ' a BitSet < BasicBlock > ,
91
89
analysis : A ,
92
90
) -> Self {
93
- Self :: new ( tcx, body, def_id, dead_unwinds , analysis, None )
91
+ Self :: new ( tcx, body, def_id, analysis, None )
94
92
}
95
93
96
94
fn new (
97
95
tcx : TyCtxt < ' tcx > ,
98
96
body : & ' a mir:: Body < ' tcx > ,
99
97
def_id : DefId ,
100
- dead_unwinds : & ' a BitSet < BasicBlock > ,
101
98
analysis : A ,
102
99
trans_for_block : Option < IndexVec < BasicBlock , GenKillSet < A :: Idx > > > ,
103
100
) -> Self {
@@ -118,12 +115,17 @@ where
118
115
tcx,
119
116
body,
120
117
def_id,
121
- dead_unwinds,
118
+ dead_unwinds : None ,
122
119
entry_sets,
123
120
trans_for_block,
124
121
}
125
122
}
126
123
124
+ pub fn dead_unwinds ( mut self , dead_unwinds : & ' a BitSet < BasicBlock > ) -> Self {
125
+ self . dead_unwinds = Some ( dead_unwinds) ;
126
+ self
127
+ }
128
+
127
129
pub fn iterate_to_fixpoint ( mut self ) -> Results < ' tcx , A > {
128
130
let mut temp_state = BitSet :: new_empty ( self . bits_per_block ) ;
129
131
@@ -229,7 +231,7 @@ where
229
231
| DropAndReplace { target, value : _, location : _, unwind : Some ( unwind) }
230
232
=> {
231
233
self . propagate_bits_into_entry_set_for ( in_out, target, dirty_list) ;
232
- if ! self . dead_unwinds . contains ( bb) {
234
+ if self . dead_unwinds . map_or ( true , |bbs| !bbs . contains ( bb) ) {
233
235
self . propagate_bits_into_entry_set_for ( in_out, unwind, dirty_list) ;
234
236
}
235
237
}
@@ -242,7 +244,7 @@ where
242
244
243
245
Call { cleanup, ref destination, ref func, ref args, .. } => {
244
246
if let Some ( unwind) = cleanup {
245
- if ! self . dead_unwinds . contains ( bb) {
247
+ if self . dead_unwinds . map_or ( true , |bbs| !bbs . contains ( bb) ) {
246
248
self . propagate_bits_into_entry_set_for ( in_out, unwind, dirty_list) ;
247
249
}
248
250
}
@@ -263,7 +265,7 @@ where
263
265
FalseUnwind { real_target, unwind } => {
264
266
self . propagate_bits_into_entry_set_for ( in_out, real_target, dirty_list) ;
265
267
if let Some ( unwind) = unwind {
266
- if ! self . dead_unwinds . contains ( bb) {
268
+ if self . dead_unwinds . map_or ( true , |bbs| !bbs . contains ( bb) ) {
267
269
self . propagate_bits_into_entry_set_for ( in_out, unwind, dirty_list) ;
268
270
}
269
271
}
0 commit comments