Reviewers: jarin,

Description:
[turbofan] Run DeadCodeElimination as part of the generic lowering phase.

This way we don't need the separate late control reduction pass over the
graph, plus we can also reduce dead code recognized by generic lowering.

[email protected]

Please review this at https://codereview.chromium.org/1198923002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+13, -23 lines):
  M src/compiler/pipeline.cc


Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index 3e46d6f5194bd6abc0356231c627d67d0d97691e..6f55e4c639541ab7aa3ceb3c385ec434e49e5a40 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -651,20 +651,6 @@ struct EarlyControlReductionPhase {
 };


-struct LateControlReductionPhase {
-  static const char* phase_name() { return "late control reduction"; }
-  void Run(PipelineData* data, Zone* temp_zone) {
-    GraphReducer graph_reducer(temp_zone, data->graph());
-    DeadCodeElimination dce(&graph_reducer, data->graph(), data->common());
- CommonOperatorReducer common(&graph_reducer, data->graph(), data->common(),
-                                 data->machine());
-    graph_reducer.AddReducer(&dce);
-    graph_reducer.AddReducer(&common);
-    graph_reducer.ReduceGraph();
-  }
-};
-
-
 struct EarlyGraphTrimmingPhase {
   static const char* phase_name() { return "early graph trimming"; }
   void Run(PipelineData* data, Zone* temp_zone) {
@@ -706,13 +692,20 @@ struct GenericLoweringPhase {
   static const char* phase_name() { return "generic lowering"; }

   void Run(PipelineData* data, Zone* temp_zone) {
-    JSGenericLowering generic(data->info()->is_typing_enabled(),
-                              data->jsgraph());
- SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common());
-    TailCallOptimization tco(data->common(), data->graph());
     JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
-    AddReducer(data, &graph_reducer, &generic);
-    AddReducer(data, &graph_reducer, &select);
+ DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
+                                              data->common());
+    CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
+                                         data->common(), data->machine());
+    JSGenericLowering generic_lowering(data->info()->is_typing_enabled(),
+                                       data->jsgraph());
+    SelectLowering select_lowering(data->jsgraph()->graph(),
+                                   data->jsgraph()->common());
+    TailCallOptimization tco(data->common(), data->graph());
+    AddReducer(data, &graph_reducer, &dead_code_elimination);
+    AddReducer(data, &graph_reducer, &common_reducer);
+    AddReducer(data, &graph_reducer, &generic_lowering);
+    AddReducer(data, &graph_reducer, &select_lowering);
     // TODO(turbofan): TCO is currently limited to stubs.
     if (data->info()->IsStub()) AddReducer(data, &graph_reducer, &tco);
     graph_reducer.ReduceGraph();
@@ -1113,9 +1106,6 @@ Handle<Code> Pipeline::GenerateCode() {
     Run<ChangeLoweringPhase>();
     // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
     RunPrintAndVerify("Lowered changes", true);
-
-    Run<LateControlReductionPhase>();
-    RunPrintAndVerify("Late Control reduced");
   } else {
     if (info()->is_osr()) {
       Run<OsrDeconstructionPhase>();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to