[llvm-commits] [llvm] r116402 - in /llvm/trunk: include/llvm/Analysis/RegionInfo.h lib/Analysis/RegionInfo.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Wed Oct 13 04:02:44 PDT 2010
Author: grosser
Date: Wed Oct 13 06:02:44 2010
New Revision: 116402
URL: http://llvm.org/viewvc/llvm-project?rev=116402&view=rev
Log:
Add Region::isTopLevelRegion().
Modified:
llvm/trunk/include/llvm/Analysis/RegionInfo.h
llvm/trunk/lib/Analysis/RegionInfo.cpp
Modified: llvm/trunk/include/llvm/Analysis/RegionInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/RegionInfo.h?rev=116402&r1=116401&r2=116402&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/RegionInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/RegionInfo.h Wed Oct 13 06:02:44 2010
@@ -292,6 +292,11 @@
/// @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.
///
Modified: llvm/trunk/lib/Analysis/RegionInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/RegionInfo.cpp?rev=116402&r1=116401&r2=116402&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/RegionInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/RegionInfo.cpp Wed Oct 13 06:02:44 2010
@@ -140,8 +140,7 @@
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;
@@ -810,9 +809,10 @@
void RegionInfo::splitBlock(BasicBlock* NewBB, BasicBlock *OldBB)
{
Region *R = getRegionFor(OldBB);
+
setRegionFor(NewBB, R);
- while (R->getEntry() == OldBB && R->getParent()) {
+ while (R->getEntry() == OldBB && !R->isTopLevelRegion()) {
R->replaceEntry(NewBB);
R = R->getParent();
}
More information about the llvm-commits
mailing list