Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: src/compiler/osr.cc

Issue 920573004: [turbofan] Fix control reducer for dead loops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/control-reducer.cc ('k') | test/cctest/compiler/test-control-reducer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/osr.cc
diff --git a/src/compiler/osr.cc b/src/compiler/osr.cc
index b0592c9d4ccbe3086740a1d8fb434930cdd327e0..e05e75b9274dfa84cea7688a85af27bc2d90aafe 100644
--- a/src/compiler/osr.cc
+++ b/src/compiler/osr.cc
@@ -218,6 +218,16 @@ bool OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common,
// and run the control reducer to clean up the graph.
osr_normal_entry->ReplaceUses(dead);
osr_loop_entry->ReplaceUses(graph->start());
+
+ // Normally the control reducer removes loops whose first input is dead,
+ // but we need to avoid that because the osr_loop is reachable through
+ // the second input, so reduce it and its phis manually.
+ osr_loop->ReplaceInput(0, dead);
+ Node* node = ControlReducer::ReduceMerge(jsgraph, common, osr_loop);
+ if (node != osr_loop) osr_loop->ReplaceUses(node);
+
+ // Run the normal control reduction, which naturally trims away the dead
+ // parts of the graph.
ControlReducer::ReduceGraph(tmp_zone, jsgraph, common);
return true;
« no previous file with comments | « src/compiler/control-reducer.cc ('k') | test/cctest/compiler/test-control-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698