Chromium Code Reviews| 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; |
| } |
| } |