| Index: runtime/vm/flow_graph_optimizer.cc
|
| diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
|
| index 358c2122de2b8148f94bfed9f1053675b45390f1..86fa5b4ac5af2cf1eb5ce8866652fc5c34a6fcba 100644
|
| --- a/runtime/vm/flow_graph_optimizer.cc
|
| +++ b/runtime/vm/flow_graph_optimizer.cc
|
| @@ -3663,15 +3663,7 @@ void ConstantPropagator::VisitGraphEntry(GraphEntryInstr* block) {
|
|
|
|
|
| void ConstantPropagator::VisitJoinEntry(JoinEntryInstr* block) {
|
| - ZoneGrowableArray<PhiInstr*>* phis = block->phis();
|
| - if (phis != NULL) {
|
| - for (intptr_t phi_idx = 0; phi_idx < phis->length(); ++phi_idx) {
|
| - PhiInstr* phi = (*phis)[phi_idx];
|
| - if (phi == NULL) continue;
|
| - phi->Accept(this);
|
| - }
|
| - }
|
| -
|
| + // Phis are visited when visiting Goto at a predecessor. See VisitGoto.
|
| for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
|
| it.Current()->Accept(this);
|
| }
|
| @@ -3712,6 +3704,12 @@ void ConstantPropagator::VisitReThrow(ReThrowInstr* instr) {
|
|
|
| void ConstantPropagator::VisitGoto(GotoInstr* instr) {
|
| SetReachable(instr->successor());
|
| +
|
| + // Phi value depends on the reachability of a predecessor. We have
|
| + // to revisit phis every time a predecessor becomes reachable.
|
| + for (PhiIterator it(instr->successor()); !it.Done(); it.Advance()) {
|
| + it.Current()->Accept(this);
|
| + }
|
| }
|
|
|
|
|
|
|