Index: runtime/vm/flow_graph.cc |
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc |
index 34ca6932d6aad8b34e57e39fe44fab42b493ba5d..8f9e48c4efecf70000a6e56e85356ea0a59e742e 100644 |
--- a/runtime/vm/flow_graph.cc |
+++ b/runtime/vm/flow_graph.cc |
@@ -522,7 +522,6 @@ void FlowGraph::ComputeDominators( |
dom_index = idom[dom_index]; |
} |
idom[block_index] = dom_index; |
- preorder_[block_index]->set_dominator(preorder_[dom_index]); |
preorder_[dom_index]->AddDominatedBlock(preorder_[block_index]); |
} |
@@ -847,6 +846,28 @@ void FlowGraph::RemoveDeadPhis(GrowableArray<PhiInstr*>* live_phis) { |
} |
+void FlowGraph::RemoveRedefinitions() { |
+ // Remove redefinition instructions inserted to inhibit hoisting. |
+ for (BlockIterator block_it = reverse_postorder_iterator(); |
+ !block_it.Done(); |
+ block_it.Advance()) { |
+ for (ForwardInstructionIterator instr_it(block_it.Current()); |
+ !instr_it.Done(); |
+ instr_it.Advance()) { |
+ RedefinitionInstr* redefinition = instr_it.Current()->AsRedefinition(); |
+ if (redefinition != NULL) { |
+ Definition* original; |
+ do { |
+ original = redefinition->value()->definition(); |
+ } while (original->IsRedefinition()); |
+ redefinition->ReplaceUsesWith(original); |
+ instr_it.RemoveCurrentFromGraph(); |
+ } |
+ } |
+ } |
+} |
+ |
+ |
// Find the natural loop for the back edge m->n and attach loop information |
// to block n (loop header). The algorithm is described in "Advanced Compiler |
// Design & Implementation" (Muchnick) p192. |