Skip to content

Commit ae51ccf

Browse files
committed
SimplifyCfg: simplify the start block
1 parent f374565 commit ae51ccf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc_mir/transform/simplify_cfg.rs

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ impl<'a> SimplifyCfg<'a> {
5050

5151
impl<'l, 'tcx> MirPass<'tcx> for SimplifyCfg<'l> {
5252
fn run_pass<'a>(&mut self, _tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource, mir: &mut Mir<'tcx>) {
53+
debug!("SimplifyCfg({:?}) - simplifying {:?}", self.label, mir);
5354
CfgSimplifier::new(mir).simplify();
5455
remove_dead_blocks(mir);
5556

@@ -78,6 +79,8 @@ impl<'a, 'tcx: 'a> CfgSimplifier<'a, 'tcx> {
7879

7980
// we can't use mir.predecessors() here because that counts
8081
// dead blocks, which we don't want to.
82+
pred_count[START_BLOCK] = 1;
83+
8184
for (_, data) in traversal::preorder(mir) {
8285
if let Some(ref term) = data.terminator {
8386
for &tgt in term.successors().iter() {

0 commit comments

Comments
 (0)