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

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: Address review comments. 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..d5eb74144383cab067ffb6d3962bf12fa8d955e0 100644
--- a/frog/leg/ssa/optimize.dart
+++ b/frog/leg/ssa/optimize.dart
@@ -296,12 +296,19 @@ class SsaDeadPhiEliminator {
}
// Remove phis that are not live.
- for (final block in graph.blocks) {
+ // Traverse in reverse order to remove phis with no uses before the
+ // phis that they might use.
+ // TODO(lrn): Handle cyclic usages.
+ List<HBasicBlock> blocks = graph.blocks;
+ for (int i = blocks.length - 1; i >= 0; i--) {
+ HBasicBlock block = blocks[i];
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)) {
+ current.block.removePhi(current);
+ }
current = next;
}
}

Powered by Google App Engine
This is Rietveld 408576698