Index: runtime/vm/flow_graph.cc |
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc |
index 34ca6932d6aad8b34e57e39fe44fab42b493ba5d..6157a160756049d76e732e80ba8ece9715b067ca 100644 |
--- a/runtime/vm/flow_graph.cc |
+++ b/runtime/vm/flow_graph.cc |
@@ -847,6 +847,24 @@ void FlowGraph::RemoveDeadPhis(GrowableArray<PhiInstr*>* live_phis) { |
} |
+void FlowGraph::RemoveRedefinitions() { |
Florian Schneider
2013/05/03 10:41:36
This is very similar to what we do with Constraint
Kevin Millikin (Google)
2013/05/03 11:47:38
That one uses a maintained list of constraints, th
|
+ // 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) { |
+ redefinition->ReplaceUsesWith(redefinition->value()->definition()); |
+ 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. |