Commit 1ec7ffed authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan] Make sure nodes are killed on replacement

In reducers, we should avoid reductions of the form

  ReduceWithValue(node, replacement)
  return Replace(node)

because such reduction does not kill the original node, so it may
become subject to resurrection from some side table (in the bug
referenced below it was load elimination's side table). Instead,
we should use

  ReduceWithValue(node, replacement)
  return Replace(replacement)

Bug: chromium:945644
Change-Id: Id210efe0d214a53241392d30b7f0eee8e7515e2a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1545229Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60517}
parent d96f5e4c
......@@ -727,7 +727,7 @@ Reduction TypedOptimization::ReduceSpeculativeNumberAdd(Node* node) {
Node* const value =
graph()->NewNode(simplified()->NumberAdd(), toNum_lhs, toNum_rhs);
ReplaceWithValue(node, value);
return Replace(node);
return Replace(value);
}
return NoChange();
}
......@@ -796,7 +796,7 @@ Reduction TypedOptimization::ReduceSpeculativeNumberBinop(Node* node) {
NumberOpFromSpeculativeNumberOp(simplified(), node->op()), toNum_lhs,
toNum_rhs);
ReplaceWithValue(node, value);
return Replace(node);
return Replace(value);
}
return NoChange();
}
......@@ -811,7 +811,7 @@ Reduction TypedOptimization::ReduceSpeculativeNumberComparison(Node* node) {
Node* const value = graph()->NewNode(
NumberOpFromSpeculativeNumberOp(simplified(), node->op()), lhs, rhs);
ReplaceWithValue(node, value);
return Replace(node);
return Replace(value);
}
return NoChange();
}
......
// Copyright 2019 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 f(v5,v6) {
const v16 = [1337,1337,-765470.5051836492];
let v19 = 0;
do {
const v20 = v19 + 1;
const v22 = Math.fround(v20);
v19 = v22;
const v23 = [v20, v22];
function v24() { v20; v22; }
const v33 = v16.indexOf(v19);
} while (v19 < 6);
}
f();
Array.prototype.push(8);
%OptimizeFunctionOnNextCall(f);
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