Index: src/compiler/pipeline.cc |
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc |
index ec57f4a52651dc90a86c71c625471665c1700d12..c4e5032b7b719bb13756d7c2101e49337223c122 100644 |
--- a/src/compiler/pipeline.cc |
+++ b/src/compiler/pipeline.cc |
@@ -872,8 +872,6 @@ struct TypedLoweringPhase { |
JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), |
data->common()); |
- LoadElimination load_elimination(&graph_reducer, data->graph(), |
- data->jsgraph()->simplified()); |
JSBuiltinReducer builtin_reducer(&graph_reducer, data->jsgraph()); |
MaybeHandle<LiteralsArray> literals_array = |
data->info()->is_native_context_specializing() |
@@ -912,7 +910,6 @@ struct TypedLoweringPhase { |
} |
AddReducer(data, &graph_reducer, &typed_lowering); |
AddReducer(data, &graph_reducer, &intrinsic_lowering); |
- AddReducer(data, &graph_reducer, &load_elimination); |
AddReducer(data, &graph_reducer, &value_numbering); |
AddReducer(data, &graph_reducer, &simple_reducer); |
AddReducer(data, &graph_reducer, &checkpoint_elimination); |
@@ -1043,6 +1040,22 @@ struct StoreStoreEliminationPhase { |
} |
}; |
+struct LoadEliminationPhase { |
+ static const char* phase_name() { return "load elimination"; } |
+ |
+ void Run(PipelineData* data, Zone* temp_zone) { |
+ // The memory optimizer requires the graphs to be trimmed, so trim now. |
+ GraphTrimmer trimmer(temp_zone, data->graph()); |
+ NodeVector roots(temp_zone); |
+ data->jsgraph()->GetCachedNodes(&roots); |
+ trimmer.TrimGraph(roots.begin(), roots.end()); |
+ |
+ // Eliminate redundant loads. |
+ LoadElimination load_elimination(data->graph(), temp_zone); |
+ load_elimination.Run(); |
+ } |
+}; |
+ |
struct MemoryOptimizationPhase { |
static const char* phase_name() { return "memory optimization"; } |
@@ -1446,6 +1459,11 @@ bool PipelineImpl::CreateGraph() { |
Run<EscapeAnalysisPhase>(); |
RunPrintAndVerify("Escape Analysed"); |
} |
+ |
+ if (FLAG_turbo_load_elimination) { |
+ Run<LoadEliminationPhase>(); |
+ RunPrintAndVerify("Load eliminated"); |
+ } |
} |
// Select representations. This has to run w/o the Typer decorator, because |