Commit c36e9591 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[compiler] Push up code to revisit uses in in-place replacements

If a node is reduced in-place (i.e not replaced by another node) we
check its inputs, and if we Recurse on at least one input we return
early. If this happens, we weren't revisiting its uses.

This CL changes this since we could have been missing revisiting of some
uses.

Change-Id: I7683a0747cec38484a047c6032980b5676b2d886
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2174505
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67715}
parent ccb7b426
......@@ -161,6 +161,11 @@ void GraphReducer::ReduceTop() {
// Check if the reduction is an in-place update of the {node}.
Node* const replacement = reduction.replacement();
if (replacement == node) {
for (Node* const user : node->uses()) {
DCHECK_IMPLIES(user == node, state_.Get(node) != State::kVisited);
Revisit(user);
}
// In-place update of {node}, may need to recurse on an input.
Node::Inputs node_inputs = node->inputs();
for (int i = 0; i < node_inputs.count(); ++i) {
......@@ -178,12 +183,6 @@ void GraphReducer::ReduceTop() {
// Check if we have a new replacement.
if (replacement != node) {
Replace(node, replacement, max_id);
} else {
// Revisit all uses of the node.
for (Node* const user : node->uses()) {
// Don't revisit this node if it refers to itself.
if (user != node) Revisit(user);
}
}
}
......
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