@@ -30,7 +30,6 @@ pub use rustc_ast::Mutability;
3030use rustc_data_structures:: fx:: FxHashMap ;
3131use rustc_data_structures:: fx:: FxHashSet ;
3232use rustc_data_structures:: graph:: dominators:: Dominators ;
33- use rustc_data_structures:: stack:: ensure_sufficient_stack;
3433use rustc_index:: bit_set:: BitSet ;
3534use rustc_index:: { Idx , IndexSlice , IndexVec } ;
3635use rustc_serialize:: { Decodable , Encodable } ;
@@ -687,57 +686,6 @@ impl<'tcx> Body<'tcx> {
687686 self . injection_phase . is_some ( )
688687 }
689688
690- /// Finds which basic blocks are actually reachable for a specific
691- /// monomorphization of this body.
692- ///
693- /// This is allowed to have false positives; just because this says a block
694- /// is reachable doesn't mean that's necessarily true. It's thus always
695- /// legal for this to return a filled set.
696- ///
697- /// Regardless, the [`BitSet::domain_size`] of the returned set will always
698- /// exactly match the number of blocks in the body so that `contains`
699- /// checks can be done without worrying about panicking.
700- ///
701- /// This is mostly useful because it lets us skip lowering the `false` side
702- /// of `if <T as Trait>::CONST`, as well as `intrinsics::debug_assertions`.
703- pub fn reachable_blocks_in_mono (
704- & self ,
705- tcx : TyCtxt < ' tcx > ,
706- instance : Instance < ' tcx > ,
707- ) -> BitSet < BasicBlock > {
708- let mut set = BitSet :: new_empty ( self . basic_blocks . len ( ) ) ;
709- self . reachable_blocks_in_mono_from ( tcx, instance, & mut set, START_BLOCK ) ;
710- set
711- }
712-
713- fn reachable_blocks_in_mono_from (
714- & self ,
715- tcx : TyCtxt < ' tcx > ,
716- instance : Instance < ' tcx > ,
717- set : & mut BitSet < BasicBlock > ,
718- bb : BasicBlock ,
719- ) {
720- if !set. insert ( bb) {
721- return ;
722- }
723-
724- let data = & self . basic_blocks [ bb] ;
725-
726- if let Some ( ( bits, targets) ) = Self :: try_const_mono_switchint ( tcx, instance, data) {
727- let target = targets. target_for_value ( bits) ;
728- ensure_sufficient_stack ( || {
729- self . reachable_blocks_in_mono_from ( tcx, instance, set, target)
730- } ) ;
731- return ;
732- }
733-
734- for target in data. terminator ( ) . successors ( ) {
735- ensure_sufficient_stack ( || {
736- self . reachable_blocks_in_mono_from ( tcx, instance, set, target)
737- } ) ;
738- }
739- }
740-
741689 /// If this basic block ends with a [`TerminatorKind::SwitchInt`] for which we can evaluate the
742690 /// dimscriminant in monomorphization, we return the discriminant bits and the
743691 /// [`SwitchTargets`], just so the caller doesn't also have to match on the terminator.
0 commit comments