SimplifyCfg: simplify the start block
This commit is contained in:
parent
f3745653e1
commit
ae51ccfa77
1 changed files with 3 additions and 0 deletions
|
@ -50,6 +50,7 @@ impl<'a> SimplifyCfg<'a> {
|
||||||
|
|
||||||
impl<'l, 'tcx> MirPass<'tcx> for SimplifyCfg<'l> {
|
impl<'l, 'tcx> MirPass<'tcx> for SimplifyCfg<'l> {
|
||||||
fn run_pass<'a>(&mut self, _tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource, mir: &mut Mir<'tcx>) {
|
fn run_pass<'a>(&mut self, _tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource, mir: &mut Mir<'tcx>) {
|
||||||
|
debug!("SimplifyCfg({:?}) - simplifying {:?}", self.label, mir);
|
||||||
CfgSimplifier::new(mir).simplify();
|
CfgSimplifier::new(mir).simplify();
|
||||||
remove_dead_blocks(mir);
|
remove_dead_blocks(mir);
|
||||||
|
|
||||||
|
@ -78,6 +79,8 @@ impl<'a, 'tcx: 'a> CfgSimplifier<'a, 'tcx> {
|
||||||
|
|
||||||
// we can't use mir.predecessors() here because that counts
|
// we can't use mir.predecessors() here because that counts
|
||||||
// dead blocks, which we don't want to.
|
// dead blocks, which we don't want to.
|
||||||
|
pred_count[START_BLOCK] = 1;
|
||||||
|
|
||||||
for (_, data) in traversal::preorder(mir) {
|
for (_, data) in traversal::preorder(mir) {
|
||||||
if let Some(ref term) = data.terminator {
|
if let Some(ref term) = data.terminator {
|
||||||
for &tgt in term.successors().iter() {
|
for &tgt in term.successors().iter() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue