@@ -9,7 +9,7 @@ use rustc::mir::{self, Body, Location, Local};
99use rustc_index:: bit_set:: BitSet ;
1010use crate :: transform:: { MirPass , MirSource } ;
1111
12- use crate :: dataflow:: generic:: { Analysis , Results , ResultsCursor } ;
12+ use crate :: dataflow:: generic:: { Analysis , Engine , Results , ResultsCursor } ;
1313use crate :: dataflow:: { do_dataflow, DebugFormatted } ;
1414use crate :: dataflow:: MoveDataParamEnv ;
1515use crate :: dataflow:: {
@@ -40,10 +40,11 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
4040 let move_data = MoveData :: gather_moves ( body, tcx) . unwrap ( ) ;
4141 let mdpe = MoveDataParamEnv { move_data : move_data, param_env : param_env } ;
4242 let dead_unwinds = BitSet :: new_empty ( body. basic_blocks ( ) . len ( ) ) ;
43- let flow_inits =
44- do_dataflow ( tcx, body, def_id, & attributes, & dead_unwinds,
45- MaybeInitializedPlaces :: new ( tcx, body, & mdpe) ,
46- |bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ) ;
43+
44+ let flow_inits = Engine :: new_gen_kill (
45+ tcx, body, def_id, & dead_unwinds,
46+ MaybeInitializedPlaces :: new ( tcx, body, & mdpe) ,
47+ ) . iterate_to_fixpoint ( ) ;
4748 let flow_uninits =
4849 do_dataflow ( tcx, body, def_id, & attributes, & dead_unwinds,
4950 MaybeUninitializedPlaces :: new ( tcx, body, & mdpe) ,
@@ -57,11 +58,15 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
5758 IndirectlyMutableLocals :: new ( tcx, body, param_env) ,
5859 |_, i| DebugFormatted :: new ( & i) ) ;
5960
60- // FIXME: add these back as dataflow analyses are migrated
61- /*
6261 if has_rustc_mir_with ( & attributes, sym:: rustc_peek_maybe_init) . is_some ( ) {
6362 sanity_check_via_rustc_peek ( tcx, body, def_id, & attributes, & flow_inits) ;
6463 }
64+ if has_rustc_mir_with ( & attributes, sym:: stop_after_dataflow) . is_some ( ) {
65+ tcx. sess . fatal ( "stop_after_dataflow ended compilation" ) ;
66+ }
67+
68+ // FIXME: add these back as dataflow analyses are migrated
69+ /*
6570 if has_rustc_mir_with(&attributes, sym::rustc_peek_maybe_uninit).is_some() {
6671 sanity_check_via_rustc_peek(tcx, body, def_id, &attributes, &flow_uninits);
6772 }
@@ -71,9 +76,6 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
7176 if has_rustc_mir_with(&attributes, sym::rustc_peek_indirectly_mutable).is_some() {
7277 sanity_check_via_rustc_peek(tcx, body, def_id, &attributes, &flow_indirectly_mut);
7378 }
74- if has_rustc_mir_with(&attributes, sym::stop_after_dataflow).is_some() {
75- tcx.sess.fatal("stop_after_dataflow ended compilation");
76- }
7779 */
7880 }
7981}
0 commit comments