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]); |
| + } |
| + 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)) { |
|
ngeoffray
2012/02/21 13:12:17
Should we visit post dominator instead?
Lasse Reichstein Nielsen
2012/02/21 13:53:56
That might work if there is no cyclic dependency.
|
| + // Remove any (dead phi) uses of current before removing current. |
| + recursiveRemove(current); |
| + } |
| current = next; |
| } |
| } |