Use zero based indexing for pass_count
This commit is contained in:
parent
80dcc52934
commit
c7e94b0efd
3 changed files with 5 additions and 3 deletions
|
@ -335,7 +335,7 @@ impl<'tcx> Body<'tcx> {
|
||||||
|
|
||||||
let mut body = Body {
|
let mut body = Body {
|
||||||
phase: MirPhase::Built,
|
phase: MirPhase::Built,
|
||||||
pass_count: 1,
|
pass_count: 0,
|
||||||
source,
|
source,
|
||||||
basic_blocks: BasicBlocks::new(basic_blocks),
|
basic_blocks: BasicBlocks::new(basic_blocks),
|
||||||
source_scopes,
|
source_scopes,
|
||||||
|
@ -370,7 +370,7 @@ impl<'tcx> Body<'tcx> {
|
||||||
pub fn new_cfg_only(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>) -> Self {
|
pub fn new_cfg_only(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>) -> Self {
|
||||||
let mut body = Body {
|
let mut body = Body {
|
||||||
phase: MirPhase::Built,
|
phase: MirPhase::Built,
|
||||||
pass_count: 1,
|
pass_count: 0,
|
||||||
source: MirSource::item(CRATE_DEF_ID.to_def_id()),
|
source: MirSource::item(CRATE_DEF_ID.to_def_id()),
|
||||||
basic_blocks: BasicBlocks::new(basic_blocks),
|
basic_blocks: BasicBlocks::new(basic_blocks),
|
||||||
source_scopes: IndexVec::new(),
|
source_scopes: IndexVec::new(),
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub(super) fn build_custom_mir<'tcx>(
|
||||||
is_polymorphic: false,
|
is_polymorphic: false,
|
||||||
tainted_by_errors: None,
|
tainted_by_errors: None,
|
||||||
injection_phase: None,
|
injection_phase: None,
|
||||||
pass_count: 1,
|
pass_count: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
body.local_decls.push(LocalDecl::new(return_ty, return_ty_span));
|
body.local_decls.push(LocalDecl::new(return_ty, return_ty_span));
|
||||||
|
|
|
@ -140,6 +140,7 @@ fn run_passes_inner<'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
body.phase = new_phase;
|
body.phase = new_phase;
|
||||||
|
body.pass_count = 0;
|
||||||
|
|
||||||
dump_mir_for_phase_change(tcx, body);
|
dump_mir_for_phase_change(tcx, body);
|
||||||
if validate || new_phase == MirPhase::Runtime(RuntimePhase::Optimized) {
|
if validate || new_phase == MirPhase::Runtime(RuntimePhase::Optimized) {
|
||||||
|
@ -171,5 +172,6 @@ pub fn dump_mir_for_pass<'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dump_mir_for_phase_change<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
|
pub fn dump_mir_for_phase_change<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
|
||||||
|
assert_eq!(body.pass_count, 0);
|
||||||
mir::dump_mir(tcx, true, body.phase.name(), &"after", body, |_, _| Ok(()))
|
mir::dump_mir(tcx, true, body.phase.name(), &"after", body, |_, _| Ok(()))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue