Skip to content

Commit

Permalink
Make repeated calls to Tree::Optimizer.run work in the presence of de…
Browse files Browse the repository at this point in the history
…pendencies.
  • Loading branch information
tcurtis committed Jul 31, 2010
1 parent f0b2807 commit 542b6b1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Tree/Optimizer.nqp
Expand Up @@ -111,6 +111,8 @@ method pass-order () {
@no-preds.push($_.key) unless
pir::exists__IQs(%!predecessors, $_.key);
}
my %old-preds := pir::clone__PP(%!predecessors);
my %old-succs := pir::clone__PP(%!successors);
while +@no-preds != 0 {
my $name := @no-preds.pop;
@result.push(self.find-pass($name));
Expand All @@ -122,6 +124,12 @@ method pass-order () {
}
}
}
pir::die('Cyclical dependency graph.') if +%!successors || +%!predecessors;
if +%!successors || +%!predecessors {
%!predecessors := %old-preds;
%!successors := %old-succs;
pir::die('Cyclical dependency graph.')
}
%!predecessors := %old-preds;
%!successors := %old-succs;
@result;
}

0 comments on commit 542b6b1

Please sign in to comment.