Commit a8152658 authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[TurboFan] Verify that return statements are 'outside' loops

Bug: 
Change-Id: Ib9ca5458554ed23e94e85e2a9cb42d816649c881
Reviewed-on: https://chromium-review.googlesource.com/781661Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49527}
parent 0645bf34
...@@ -387,6 +387,7 @@ class LoopFinderImpl { ...@@ -387,6 +387,7 @@ class LoopFinderImpl {
// Search the marks word by word. // Search the marks word by word.
for (int i = 0; i < width_; i++) { for (int i = 0; i < width_; i++) {
uint32_t marks = backward_[pos + i] & forward_[pos + i]; uint32_t marks = backward_[pos + i] & forward_[pos + i];
for (int j = 0; j < 32; j++) { for (int j = 0; j < 32; j++) {
if (marks & (1u << j)) { if (marks & (1u << j)) {
int loop_num = i * 32 + j; int loop_num = i * 32 + j;
...@@ -401,6 +402,10 @@ class LoopFinderImpl { ...@@ -401,6 +402,10 @@ class LoopFinderImpl {
} }
} }
if (innermost == nullptr) continue; if (innermost == nullptr) continue;
// Return statements should never be found by forward or backward walk.
CHECK(ni.node->opcode() != IrOpcode::kReturn);
AddNodeToLoop(&ni, innermost, innermost_index); AddNodeToLoop(&ni, innermost, innermost_index);
count++; count++;
} }
...@@ -421,6 +426,10 @@ class LoopFinderImpl { ...@@ -421,6 +426,10 @@ class LoopFinderImpl {
size_t count = 0; size_t count = 0;
for (NodeInfo& ni : info_) { for (NodeInfo& ni : info_) {
if (ni.node == nullptr || !IsInLoop(ni.node, 1)) continue; if (ni.node == nullptr || !IsInLoop(ni.node, 1)) continue;
// Return statements should never be found by forward or backward walk.
CHECK(ni.node->opcode() != IrOpcode::kReturn);
AddNodeToLoop(&ni, li, 1); AddNodeToLoop(&ni, li, 1);
count++; count++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment