Skip to content

Commit

Permalink
Only unset argInfo if value changes
Browse files Browse the repository at this point in the history
Signed-off-by: Liqun Liu <liqunl@ca.ibm.com>
  • Loading branch information
Liqun Liu committed Nov 23, 2020
1 parent f719080 commit 2565771
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions compiler/optimizer/Inliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6383,6 +6383,7 @@ OMR_InlinerUtil::clearArgInfoForNonInvariantArguments(TR_CallTarget *target, TR_
traceMsg(comp(), "Clearing arg info for non invariant arguments\n");

TR::ResolvedMethodSymbol* methodSymbol = target->_calleeSymbol;

TR_PrexArgInfo* argInfo = target->_prexArgInfo;
if (!argInfo)
{
Expand All @@ -6402,12 +6403,26 @@ OMR_InlinerUtil::clearArgInfoForNonInvariantArguments(TR_CallTarget *target, TR_

TR_ASSERT(storeNode->getSymbolReference(), "stores should have symRefs");
TR::ParameterSymbol* parmSymbol = storeNode->getSymbolReference()->getSymbol()->getParmSymbol();
if (parmSymbol->getOrdinal() < argInfo->getNumArgs())
{
if (tracePrex)
traceMsg(comp(), "ARGS PROPAGATION: unsetting an arg [%i] of argInfo %p", parmSymbol->getOrdinal(), argInfo);
argInfo->set(parmSymbol->getOrdinal(), NULL);
cleanedAnything = true;
auto ordinal = parmSymbol->getOrdinal();
if (ordinal < argInfo->getNumArgs() && argInfo->get(ordinal))
{
auto prexArg = argInfo->get(ordinal);
// If the value to store is the same as the original value, don't unset the arg info
auto valueNode = storeNode->getFirstChild();
if (valueNode->getOpCode().hasSymbolReference() &&
valueNode->getSymbolReference()->hasKnownObjectIndex() &&
prexArg->getKnownObjectIndex() == valueNode->getSymbolReference()->getKnownObjectIndex())
{
if (tracePrex)
traceMsg(comp(), "ARGS PROPAGATION: arg %d holds the same value after store node n%dn, keep argInfo %p", ordinal, storeNode->getGlobalIndex(), argInfo);
}
else
{
if (tracePrex)
traceMsg(comp(), "ARGS PROPAGATION: unsetting an arg [%i] of argInfo %p", parmSymbol->getOrdinal(), argInfo);
argInfo->set(parmSymbol->getOrdinal(), NULL);
cleanedAnything = true;
}
}
}

Expand Down

0 comments on commit 2565771

Please sign in to comment.