From 393882c7b0cdee9725f053ae27e1ba81464440f2 Mon Sep 17 00:00:00 2001 From: Abdulrahman Alattas Date: Mon, 16 Dec 2024 10:52:37 -0500 Subject: [PATCH] Compare nodes instead of symRef in SequentialStoreSimplification 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. --- .../compiler/optimizer/SequentialStoreSimplifier.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/runtime/compiler/optimizer/SequentialStoreSimplifier.cpp b/runtime/compiler/optimizer/SequentialStoreSimplifier.cpp index 366eec56d65..e4244ee3535 100644 --- a/runtime/compiler/optimizer/SequentialStoreSimplifier.cpp +++ b/runtime/compiler/optimizer/SequentialStoreSimplifier.cpp @@ -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; @@ -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; @@ -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;