| Index: runtime/vm/flow_graph_builder.cc
|
| diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
|
| index ea3c452243c0acafec742c862d1b071c96e608ad..28c563ef91ca767b804f718ed464fb836a93cbc5 100644
|
| --- a/runtime/vm/flow_graph_builder.cc
|
| +++ b/runtime/vm/flow_graph_builder.cc
|
| @@ -2710,6 +2710,12 @@ void FlowGraphBuilder::RenameRecursive(BlockEntryInstr* block_entry,
|
| if ((as_bind != NULL) &&
|
| (as_bind->computation()->IsLoadLocal() ||
|
| as_bind->computation()->IsStoreLocal())) {
|
| + // Assert exactly one use.
|
| + ASSERT(as_bind->use_list() == v);
|
| + ASSERT(as_bind->use_list()->next_use() == NULL);
|
| + // Remove the use, its defintion and copy the environment value.
|
| + v->RemoveFromUseList();
|
| + as_bind->RemoveFromGraph();
|
| current->SetInputAt(i, CopyValue(input_value));
|
| }
|
| }
|
| @@ -2747,11 +2753,16 @@ void FlowGraphBuilder::RenameRecursive(BlockEntryInstr* block_entry,
|
| }
|
| }
|
| }
|
| - // Update expression stack and remove from graph.
|
| + // Update expression stack or remove from graph.
|
| if (bind->is_used()) {
|
| + // Assert exactly one use.
|
| + ASSERT(bind->use_list() != NULL);
|
| + ASSERT(bind->use_list()->next_use() == NULL);
|
| env->Add(CopyValue((*env)[index]));
|
| + // We remove load/store instructions when we find their use in 2a.
|
| + } else {
|
| + it.RemoveCurrentFromGraph();
|
| }
|
| - it.RemoveCurrentFromGraph();
|
| } else {
|
| // Not a load or store.
|
| if (bind->is_used()) {
|
| @@ -2790,10 +2801,7 @@ void FlowGraphBuilder::RenameRecursive(BlockEntryInstr* block_entry,
|
| PhiInstr* phi = (*successor->phis())[i];
|
| if (phi != NULL) {
|
| // Rename input operand and make a copy if it is a UseVal.
|
| - Value* new_val = (*env)[i]->IsUse()
|
| - ? new UseVal((*env)[i]->AsUse()->definition())
|
| - : (*env)[i];
|
| - phi->SetInputAt(pred_index, new_val);
|
| + phi->SetInputAt(pred_index, CopyValue((*env)[i]));
|
| }
|
| }
|
| }
|
|
|