[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: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#67715}
This commit is contained in:
parent
ccb7b42697
commit
c36e959137
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user