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

Unified Diff: src/compiler/loop-analysis.cc

Issue 852783002: [turbofan] Fix corner case in loop analysis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | test/cctest/compiler/test-loop-analysis.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/loop-analysis.cc
diff --git a/src/compiler/loop-analysis.cc b/src/compiler/loop-analysis.cc
index 01b9659e6bd0752fb2a765eb1bbc0660eb160e82..e839130b43a191f5c3389e379e548438250c3552 100644
--- a/src/compiler/loop-analysis.cc
+++ b/src/compiler/loop-analysis.cc
@@ -152,18 +152,22 @@ class LoopFinderImpl {
queued_.Set(node, false);
// Setup loop headers first.
+ NodeInfo& ni = info(node);
if (node->opcode() == IrOpcode::kLoop) {
// found the loop node first.
- CreateLoopInfo(node);
+ CreateLoopInfo(node, ni);
} else if (node->opcode() == IrOpcode::kPhi ||
node->opcode() == IrOpcode::kEffectPhi) {
// found a phi first.
Node* merge = node->InputAt(node->InputCount() - 1);
- if (merge->opcode() == IrOpcode::kLoop) CreateLoopInfo(merge);
+ if (merge->opcode() == IrOpcode::kLoop) {
+ NodeInfo& mi = info(merge);
+ CreateLoopInfo(merge, mi);
+ ni.MarkBackward(mi.loop_mark);
+ }
}
// Propagate reachability marks backwards from this node.
- NodeInfo& ni = info(node);
if (ni.IsLoopHeader()) {
// Handle edges from loop header nodes specially.
for (int i = 0; i < node->InputCount(); i++) {
@@ -186,8 +190,7 @@ class LoopFinderImpl {
}
// Make a new loop header for the given node.
- void CreateLoopInfo(Node* node) {
- NodeInfo& ni = info(node);
+ void CreateLoopInfo(Node* node, NodeInfo& ni) {
if (ni.IsLoopHeader()) return; // loop already set up.
loops_found_++;
@@ -197,7 +200,6 @@ class LoopFinderImpl {
loops_.push_back({node, nullptr, nullptr, nullptr});
loop_tree_->NewLoop();
LoopMarks loop_mark = kVisited | (1 << loop_num);
- ni.node = node;
ni.loop_mark = loop_mark;
// Setup loop mark for phis attached to loop header.
« no previous file with comments | « no previous file | test/cctest/compiler/test-loop-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698