Commit bdf446f5 authored by jarin's avatar jarin Committed by Commit bot

Do not reduce effect phis for loops.

This prevents eliminating effectful statements before the loop.

BUG=

Review URL: https://codereview.chromium.org/830923002

Cr-Commit-Position: refs/heads/master@{#25953}
parent 26fce420
......@@ -403,6 +403,14 @@ class ControlReducerImpl {
if (n <= 1) return dead(); // No non-control inputs.
if (n == 2) return node->InputAt(0); // Only one non-control input.
// Never remove an effect phi from a (potentially non-terminating) loop.
// Otherwise, we might end up eliminating effect nodes, such as calls,
// before the loop.
if (node->opcode() == IrOpcode::kEffectPhi &&
NodeProperties::GetControlInput(node)->opcode() == IrOpcode::kLoop) {
return node;
}
Node* replacement = NULL;
Node::Inputs inputs = node->inputs();
for (InputIter it = inputs.begin(); n > 1; --n, ++it) {
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
function g() {
throw 0;
}
function f() {
g();
while (1) {}
}
assertThrows(function () { f(); });
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