Skip to content

Commit

Permalink
Merge pull request #6531 from jdmpapin/versioner-acyclic
Browse files Browse the repository at this point in the history
Make versioner skip loops that have become acyclic during the pass
  • Loading branch information
vijaysun-omr committed Jun 2, 2022
2 parents e626f00 + 505add7 commit 7bb3f9d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions compiler/optimizer/LoopVersioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,22 @@ int32_t TR_LoopVersioner::performWithoutDominators()
// break;
//else
// _counter++;

TR_RegionStructure *naturalLoop = nextWhileLoop->asRegion();

// HCR guard versioning removes edges from the CFG immediately (unlike
// versioning of regular conditionals/virtual guards, which leaves a
// trivially foldable conditional tree in place). The removal of
// particular edges can change loops into acyclic regions, so skip any
// region that is no longer a loop.
//
// (OSR guard versioning also removes edges immediately, but the targets
// of those edges are not within any loop, so their removal can't change
// loops into acyclic regions.)
//
if (!naturalLoop->isNaturalLoop())
continue;

TR::Block *entryBlock = naturalLoop->getEntryBlock();
if (!loopIsWorthVersioning(naturalLoop))
continue;
Expand Down

0 comments on commit 7bb3f9d

Please sign in to comment.