diff --git a/compiler/optimizer/LocalAnalysis.cpp b/compiler/optimizer/LocalAnalysis.cpp index 74ce9c52048..61b0d281cfb 100644 --- a/compiler/optimizer/LocalAnalysis.cpp +++ b/compiler/optimizer/LocalAnalysis.cpp @@ -488,7 +488,7 @@ int TR_LocalAnalysisInfo::hasOldExpressionOnRhs(TR::Node *node, bool recalcConta #endif bool seenWriteBarrier = false; int32_t storeNumChildren = node->getNumChildren(); - + bool isStoreIndirect = node->getOpCode().isStoreIndirect(); // If node is a null check, compare the // null check reference only to establish syntactic equivalence @@ -528,7 +528,7 @@ int TR_LocalAnalysisInfo::hasOldExpressionOnRhs(TR::Node *node, bool recalcConta #endif TR::Node::recreate(node, _compilation->il.opCodeForCorrespondingLoadOrStore(node->getOpCodeValue())); - if (node->getOpCode().isStoreIndirect()) + if (isStoreIndirect) { node->setNumChildren(1); } @@ -548,6 +548,7 @@ int TR_LocalAnalysisInfo::hasOldExpressionOnRhs(TR::Node *node, bool recalcConta int32_t hashValue = _hashTable->hash(node); HashTable::Cursor cursor(_hashTable, hashValue); TR::Node *other; + bool tmpIsStoreIndirect = false; for (other = cursor.firstNode(); other; other = cursor.nextNode()) { // Convert other node's opcode to be a load temporarily @@ -566,12 +567,13 @@ int TR_LocalAnalysisInfo::hasOldExpressionOnRhs(TR::Node *node, bool recalcConta if (other->getOpCode().isWrtBar()) seenOtherWriteBarrier = true; + tmpIsStoreIndirect = other->getOpCode().isStoreIndirect(); #ifdef J9_PROJECT_SPECIFIC seenOtherIndirectBCDStore = other->getType().isBCD(); #endif TR::Node::recreate(other, _compilation->il.opCodeForCorrespondingLoadOrStore(other->getOpCodeValue())); - if (other->getOpCode().isStoreIndirect()) + if (tmpIsStoreIndirect) { other->setNumChildren(1); }