Commit 5e269d56 authored by Manos Koukoutos's avatar Manos Koukoutos Committed by V8 LUCI CQ

[turbofan] Do not map nodes to the same path state

In {ControlPathState} with {kMultipleInstances}, a node should be able
to be mapped to different states, but not twice to an identical state.

Change-Id: Ida340a6f4f5e891f586d5a90e7ae818f24dfbe98
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3769693
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81775}
parent 090156f8
...@@ -135,7 +135,11 @@ template <typename NodeState, NodeUniqueness node_uniqueness> ...@@ -135,7 +135,11 @@ template <typename NodeState, NodeUniqueness node_uniqueness>
void ControlPathState<NodeState, node_uniqueness>::AddState( void ControlPathState<NodeState, node_uniqueness>::AddState(
Zone* zone, Node* node, NodeState state, Zone* zone, Node* node, NodeState state,
ControlPathState<NodeState, node_uniqueness> hint) { ControlPathState<NodeState, node_uniqueness> hint) {
if (node_uniqueness == kUniqueInstance && LookupState(node).IsSet()) return; NodeState previous_state = LookupState(node);
if (node_uniqueness == kUniqueInstance ? previous_state.IsSet()
: previous_state == state) {
return;
}
FunctionalList<NodeState> prev_front = blocks_.Front(); FunctionalList<NodeState> prev_front = blocks_.Front();
if (hint.blocks_.Size() > 0) { if (hint.blocks_.Size() > 0) {
...@@ -153,7 +157,9 @@ template <typename NodeState, NodeUniqueness node_uniqueness> ...@@ -153,7 +157,9 @@ template <typename NodeState, NodeUniqueness node_uniqueness>
void ControlPathState<NodeState, node_uniqueness>::AddStateInNewBlock( void ControlPathState<NodeState, node_uniqueness>::AddStateInNewBlock(
Zone* zone, Node* node, NodeState state) { Zone* zone, Node* node, NodeState state) {
FunctionalList<NodeState> new_block; FunctionalList<NodeState> new_block;
if (node_uniqueness == kMultipleInstances || !LookupState(node).IsSet()) { NodeState previous_state = LookupState(node);
if (node_uniqueness == kUniqueInstance ? !previous_state.IsSet()
: previous_state != state) {
new_block.PushFront(state, zone); new_block.PushFront(state, zone);
states_.Set({node, depth(blocks_.Size() + 1)}, state); states_.Set({node, depth(blocks_.Size() + 1)}, state);
} }
......
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