| 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..39a1d22f8e0e81629632a34473b84c84a94025dd 100644
|
| --- a/runtime/vm/flow_graph_optimizer.cc
|
| +++ b/runtime/vm/flow_graph_optimizer.cc
|
| @@ -3663,18 +3663,12 @@ 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 predecessor. See VisitSuccessorPhis.
|
| for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
|
| it.Current()->Accept(this);
|
| }
|
| +
|
| + VisitSuccessorPhis(block);
|
| }
|
|
|
|
|
| @@ -3682,6 +3676,8 @@ void ConstantPropagator::VisitTargetEntry(TargetEntryInstr* block) {
|
| for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
|
| it.Current()->Accept(this);
|
| }
|
| +
|
| + VisitSuccessorPhis(block);
|
| }
|
|
|
|
|
| @@ -3691,6 +3687,18 @@ void ConstantPropagator::VisitParallelMove(ParallelMoveInstr* instr) {
|
| }
|
|
|
|
|
| +void ConstantPropagator::VisitSuccessorPhis(BlockEntryInstr* block) {
|
| + // Phi value depends on the reachability of a predecessor. We have
|
| + // to revisit phis every time a predecessor becomes reachable.
|
| + GotoInstr* goto_instr = block->last_instruction()->AsGoto();
|
| + if (goto_instr != NULL) {
|
| + for (PhiIterator it(goto_instr->successor()); !it.Done(); it.Advance()) {
|
| + it.Current()->Accept(this);
|
| + }
|
| + }
|
| +}
|
| +
|
| +
|
| // --------------------------------------------------------------------------
|
| // Analysis of control instructions. Unconditional successors are
|
| // reachable. Conditional successors are reachable depending on the
|
|
|