Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Unified Diff: frog/leg/ssa/optimize.dart

Issue 9421035: Support break and labeled statements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: frog/leg/ssa/optimize.dart
diff --git a/frog/leg/ssa/optimize.dart b/frog/leg/ssa/optimize.dart
index 1f1a029aeaf8bff9407fa4bc6569399abff3be31..5d07e406b03f988987bc4ec019f808533f2ffee6 100644
--- a/frog/leg/ssa/optimize.dart
+++ b/frog/leg/ssa/optimize.dart
@@ -295,13 +295,23 @@ class SsaDeadPhiEliminator {
}
}
+ recursiveRemove(HPhi phi) {
+ while (!phi.usedBy.isEmpty()) {
+ recursiveRemove(phi.usedBy[0]);
floitsch 2012/02/20 19:01:54 are you sure this can't yield an infinite loop?
Lasse Reichstein Nielsen 2012/02/21 13:53:56 Not absolutely. I guess we could have recursive de
+ }
+ phi.block.removePhi(phi);
+ }
+
// Remove phis that are not live.
for (final block in graph.blocks) {
HPhi current = block.phis.first;
HPhi next = null;
while (current != null) {
next = current.next;
- if (!livePhis.contains(current)) block.removePhi(current);
+ if (!livePhis.contains(current)) {
+ // Remove any (dead phi) uses of current before removing current.
+ recursiveRemove(current);
+ }
current = next;
}
}

Powered by Google App Engine
This is Rietveld 408576698