Skip to content

Commit

Permalink
Merge pull request #1835 from ncough/osrFix
Browse files Browse the repository at this point in the history
Manage additional blocks in OSR infrastructure
  • Loading branch information
vijaysun-omr authored Oct 26, 2017
2 parents 604be15 + 35e988e commit 470bcf7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion compiler/optimizer/OSRDefAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,13 @@ int32_t TR_OSRExceptionEdgeRemoval::perform()
return 0;
}

if (comp()->osrInfrastructureRemoved())
{
if (comp()->getOption(TR_TraceOSR))
traceMsg(comp(), "OSR infrastructure removed -- returning from OSR exception edge removal analysis since we have already removed OSR infrastructure.\n");
return 0;
}

if (comp()->isPeekingMethod())
{
if (comp()->getOption(TR_TraceOSR))
Expand Down Expand Up @@ -1656,7 +1663,6 @@ int32_t TR_OSRExceptionEdgeRemoval::perform()
for (auto edge = block->getPredecessors().begin(); edge != block->getPredecessors().end(); ++edge)
{
TR::Block *osrBlock = toBlock((*edge)->getFrom());
TR_ASSERT(osrBlock && (osrBlock->isOSRCodeBlock() || osrBlock->isOSRCatchBlock()), "Predecessors to an OSR code block should be OSR code or catch blocks");
if (osrBlock->isOSRCodeBlock() && addDeadStores(osrBlock, alwaysDead, !firstPass))
osrBlocks.push(osrBlock);
else if (osrBlock->isOSRCatchBlock())
Expand All @@ -1670,9 +1676,18 @@ int32_t TR_OSRExceptionEdgeRemoval::perform()
firstPass = false;
}
}
else
{
// Another block was found in the OSR infrastructure, give up
alwaysDead.empty();
break;
}
firstPass = false;
}

if (alwaysDead.isEmpty())
continue;

// Remove loads that are always dead
for (int32_t i = 0 ; i < prepareForOSR->getNumChildren(); ++i)
{
Expand Down

0 comments on commit 470bcf7

Please sign in to comment.