git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116402
91177308-0d34-0410-b5e6-
96231b3b80d8
/// @return The depth of the region.
unsigned getDepth() const;
/// @return The depth of the region.
unsigned getDepth() const;
+ /// @brief Check if a Region is the TopLevel region.
+ ///
+ /// The toplevel region represents the whole function.
+ bool isTopLevelRegion() const { return exit == NULL; };
+
/// @brief Return a new (non canonical) region, that is obtained by joining
/// this region with its predecessors.
///
/// @brief Return a new (non canonical) region, that is obtained by joining
/// this region with its predecessors.
///
BasicBlock *entry = getEntry(), *exit = getExit();
BasicBlock *entry = getEntry(), *exit = getExit();
- // TopLevelRegion
- if (!exit)
+ if (isTopLevelRegion())
return false;
for (pred_iterator PI = pred_begin(entry), PE = pred_end(entry); PI != PE;
return false;
for (pred_iterator PI = pred_begin(entry), PE = pred_end(entry); PI != PE;
void RegionInfo::splitBlock(BasicBlock* NewBB, BasicBlock *OldBB)
{
Region *R = getRegionFor(OldBB);
void RegionInfo::splitBlock(BasicBlock* NewBB, BasicBlock *OldBB)
{
Region *R = getRegionFor(OldBB);
- while (R->getEntry() == OldBB && R->getParent()) {
+ while (R->getEntry() == OldBB && !R->isTopLevelRegion()) {
R->replaceEntry(NewBB);
R = R->getParent();
}
R->replaceEntry(NewBB);
R = R->getParent();
}