Skip to content

Commit

Permalink
Invalidate parmInfo for DLT compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
BradleyWood committed Jun 21, 2021
1 parent b7eb963 commit 6374ead
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions compiler/optimizer/ValuePropagationCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,30 +178,44 @@ void OMR::ValuePropagation::initialize()
int32_t numParms = comp()->getMethodSymbol()->getParameterList().getSize();
_parmInfo = (int32_t *) trMemory()->allocateStackMemory(numParms * sizeof(int32_t));
_parmTypeValid = (bool *) trMemory()->allocateStackMemory(numParms * sizeof(bool));
// mark all parms as invariant (0) to begin with
//
memset(_parmInfo, 0, numParms * sizeof(int32_t));

// mark info to be true
for (int32_t i = 0; i < numParms; i++)
_parmTypeValid[i] = true;

for (TR::TreeTop *tt = comp()->getStartTree();
tt;
tt = tt->getNextTreeTop())
// we cant assume parm info to be valid for DLT compiles
// the type may change after execution begins
if (comp()->isDLT())
{
TR::Node *node = tt->getNode();
if (node && node->getOpCodeValue() == TR::treetop)
node = node->getFirstChild();
for (int32_t i = 0; i < numParms; i++)
{
_parmInfo[i] = 1;
}
}
else
{
// mark all parms as invariant (0) to begin with
//
memset(_parmInfo, 0, numParms * sizeof(int32_t));

if (node && node->getOpCode().isStoreDirect())
for (TR::TreeTop *tt = comp()->getStartTree();
tt;
tt = tt->getNextTreeTop())
{
TR::Symbol *sym = node->getSymbolReference()->getSymbol();
if (sym->isParm())
TR::Node *node = tt->getNode();
if (node && node->getOpCodeValue() == TR::treetop)
node = node->getFirstChild();

if (node && node->getOpCode().isStoreDirect())
{
// parm is no longer invariant
//
int32_t index = sym->getParmSymbol()->getOrdinal();
_parmInfo[index] = 1;
TR::Symbol *sym = node->getSymbolReference()->getSymbol();
if (sym->isParm())
{
// parm is no longer invariant
//
int32_t index = sym->getParmSymbol()->getOrdinal();
_parmInfo[index] = 1;
}
}
}
}
Expand Down

0 comments on commit 6374ead

Please sign in to comment.