| Index: runtime/vm/flow_graph.cc
|
| diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
|
| index 7caa3f90bb0f9d69673c955cdf797730e5e3874a..cdca0e44541938752e5b90441ca14e67f24a3090 100644
|
| --- a/runtime/vm/flow_graph.cc
|
| +++ b/runtime/vm/flow_graph.cc
|
| @@ -12,6 +12,7 @@
|
|
|
| namespace dart {
|
|
|
| +DEFINE_FLAG(bool, prune_dead_locals, true, "optimize dead locals away");
|
| DECLARE_FLAG(bool, reorder_basic_blocks);
|
| DECLARE_FLAG(bool, trace_optimization);
|
| DECLARE_FLAG(bool, verify_compiler);
|
| @@ -872,7 +873,7 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
| // slots with null.
|
| BitVector* live_in = variable_liveness->GetLiveInSet(block_entry);
|
| for (intptr_t i = 0; i < variable_count(); i++) {
|
| - if (!live_in->Contains(i)) {
|
| + if (FLAG_prune_dead_locals && !live_in->Contains(i)) {
|
| (*env)[i] = constant_dead();
|
| }
|
| }
|
| @@ -940,7 +941,8 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
| intptr_t index = store->local().BitIndexIn(num_non_copied_params_);
|
| result = store->value()->definition();
|
|
|
| - if (variable_liveness->IsStoreAlive(block_entry, store)) {
|
| + if (!FLAG_prune_dead_locals ||
|
| + variable_liveness->IsStoreAlive(block_entry, store)) {
|
| (*env)[index] = result;
|
| } else {
|
| (*env)[index] = constant_dead();
|
| @@ -958,7 +960,8 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
| live_phis->Add(phi);
|
| }
|
|
|
| - if (variable_liveness->IsLastLoad(block_entry, load)) {
|
| + if (FLAG_prune_dead_locals &&
|
| + variable_liveness->IsLastLoad(block_entry, load)) {
|
| (*env)[index] = constant_dead();
|
| }
|
|
|
|
|