2525 tcx : TyCtxt < ' tcx > ,
2626 body : & ' a mir:: Body < ' tcx > ,
2727 def_id : DefId ,
28- dead_unwinds : & ' a BitSet < BasicBlock > ,
28+ dead_unwinds : Option < & ' a BitSet < BasicBlock > > ,
2929 entry_sets : IndexVec < BasicBlock , BitSet < A :: Idx > > ,
3030 analysis : A ,
3131
4242 tcx : TyCtxt < ' tcx > ,
4343 body : & ' a mir:: Body < ' tcx > ,
4444 def_id : DefId ,
45- dead_unwinds : & ' a BitSet < BasicBlock > ,
4645 analysis : A ,
4746 ) -> Self {
4847 let bits_per_block = analysis. bits_per_block ( body) ;
7069 }
7170 }
7271
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) )
7473 }
7574}
7675
@@ -87,17 +86,15 @@ where
8786 tcx : TyCtxt < ' tcx > ,
8887 body : & ' a mir:: Body < ' tcx > ,
8988 def_id : DefId ,
90- dead_unwinds : & ' a BitSet < BasicBlock > ,
9189 analysis : A ,
9290 ) -> Self {
93- Self :: new ( tcx, body, def_id, dead_unwinds , analysis, None )
91+ Self :: new ( tcx, body, def_id, analysis, None )
9492 }
9593
9694 fn new (
9795 tcx : TyCtxt < ' tcx > ,
9896 body : & ' a mir:: Body < ' tcx > ,
9997 def_id : DefId ,
100- dead_unwinds : & ' a BitSet < BasicBlock > ,
10198 analysis : A ,
10299 trans_for_block : Option < IndexVec < BasicBlock , GenKillSet < A :: Idx > > > ,
103100 ) -> Self {
@@ -118,12 +115,17 @@ where
118115 tcx,
119116 body,
120117 def_id,
121- dead_unwinds,
118+ dead_unwinds : None ,
122119 entry_sets,
123120 trans_for_block,
124121 }
125122 }
126123
124+ pub fn dead_unwinds ( mut self , dead_unwinds : & ' a BitSet < BasicBlock > ) -> Self {
125+ self . dead_unwinds = Some ( dead_unwinds) ;
126+ self
127+ }
128+
127129 pub fn iterate_to_fixpoint ( mut self ) -> Results < ' tcx , A > {
128130 let mut temp_state = BitSet :: new_empty ( self . bits_per_block ) ;
129131
@@ -229,7 +231,7 @@ where
229231 | DropAndReplace { target, value : _, location : _, unwind : Some ( unwind) }
230232 => {
231233 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) ) {
233235 self . propagate_bits_into_entry_set_for ( in_out, unwind, dirty_list) ;
234236 }
235237 }
@@ -242,7 +244,7 @@ where
242244
243245 Call { cleanup, ref destination, ref func, ref args, .. } => {
244246 if let Some ( unwind) = cleanup {
245- if ! self . dead_unwinds . contains ( bb) {
247+ if self . dead_unwinds . map_or ( true , |bbs| !bbs . contains ( bb) ) {
246248 self . propagate_bits_into_entry_set_for ( in_out, unwind, dirty_list) ;
247249 }
248250 }
@@ -263,7 +265,7 @@ where
263265 FalseUnwind { real_target, unwind } => {
264266 self . propagate_bits_into_entry_set_for ( in_out, real_target, dirty_list) ;
265267 if let Some ( unwind) = unwind {
266- if ! self . dead_unwinds . contains ( bb) {
268+ if self . dead_unwinds . map_or ( true , |bbs| !bbs . contains ( bb) ) {
267269 self . propagate_bits_into_entry_set_for ( in_out, unwind, dirty_list) ;
268270 }
269271 }
0 commit comments