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

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..1b5f5288f4d2157585cf8f99be7b09ad49ffd957 100644
--- a/src/compiler/loop-analysis.cc
+++ b/src/compiler/loop-analysis.cc
@@ -152,18 +152,20 @@ 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) {
+ ni.MarkBackward(CreateLoopInfo(merge, info(merge)).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,9 +188,8 @@ class LoopFinderImpl {
}
// Make a new loop header for the given node.
- void CreateLoopInfo(Node* node) {
- NodeInfo& ni = info(node);
- if (ni.IsLoopHeader()) return; // loop already set up.
+ NodeInfo& CreateLoopInfo(Node* node, NodeInfo& ni) {
Michael Starzinger 2015/01/14 16:28:32 nit: Instead of returning the NodeInfo here, we co
+ if (ni.IsLoopHeader()) return ni; // loop already set up.
loops_found_++;
size_t loop_num = loops_.size() + 1;
@@ -197,7 +198,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.
@@ -207,6 +207,7 @@ class LoopFinderImpl {
info(use).loop_mark = loop_mark;
}
}
+ return ni;
}
// Propagate marks forward from loops.
« 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