Skip to content

Commit

Permalink
Compare nodes instead of symRef in SequentialStoreSimplification
Browse files Browse the repository at this point in the history
SequentialStoreSimplification compares baseVar symRef to confirm stores
being to the same array for simplification. For object fields the symRef
matches even if arrays are different.

To fix the issue a node check is used instead to make sure that its
storing to the same array even if symRefs match.
  • Loading branch information
rmnattas committed Dec 17, 2024
1 parent a6331e7 commit 61b4851
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions runtime/compiler/optimizer/SequentialStoreSimplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1655,8 +1655,9 @@ bool TR_arraycopySequentialStores::insertConsistentTree()
dumpOptDetails(comp(), " insertTree: multiplier must be 1 in aiadd tree\n");
return false;
}
TR::SymbolReference* activeBaseRef = _activeAddrTree->getBaseVarNode()->isNull() ? NULL : _activeAddrTree->getBaseVarNode()->getChild()->skipConversions()->getSymbolReference();
if (activeBaseRef == NULL)

TR::Node* activeBaseNode = _activeAddrTree->getBaseVarNode()->isNull() ? NULL : _activeAddrTree->getBaseVarNode()->getChild()->skipConversions();
if (activeBaseNode == NULL)
{
dumpOptDetails(comp(), " insertTree: no base variable in aiadd tree\n");
return false;
Expand All @@ -1670,8 +1671,8 @@ bool TR_arraycopySequentialStores::insertConsistentTree()
}

// make sure the index variable and base variable is consistent with the first tree
TR::SymbolReference* baseRef = _addrTree[0]->getBaseVarNode()->isNull() ? NULL : _addrTree[0]->getBaseVarNode()->getChild()->skipConversions()->getSymbolReference();
if (baseRef != activeBaseRef)
TR::Node* baseNode = _addrTree[0]->getBaseVarNode()->isNull() ? NULL : _addrTree[0]->getBaseVarNode()->getChild()->skipConversions();
if (baseNode != activeBaseNode)
{
dumpOptDetails(comp(), " insertTree: base variable is different than previous tree\n");
return false;
Expand Down Expand Up @@ -1707,7 +1708,7 @@ bool TR_arraycopySequentialStores::insertConsistentTree()
}

// make sure the value tree doesn't reference the address tree base var
if (_activeValueTree->getRootNode()->referencesSymbolInSubTree(baseRef, _comp->incOrResetVisitCount()))
if (_activeValueTree->getRootNode() == baseNode || _activeValueTree->getRootNode()->hasChild(baseNode))
{
dumpOptDetails(comp(), " insertTree: value tree %p references address tree base var\n", _activeValueTree->getRootNode());
return false;
Expand Down

0 comments on commit 61b4851

Please sign in to comment.