commit 1cedd2a4370cbc956a5019dddc55706782452fcf
Author: ether <ethe...@gmail.com>
Date: Mon Apr 4 11:20:19 2011 +0800
RegionSimplify: Add some debug code to createSingleExitEdge.
diff --git a/lib/RegionSimplify.cpp b/lib/RegionSimplify.cpp
index eb61e38..5e6e9c7 100644
--- a/lib/RegionSimplify.cpp
+++ b/lib/RegionSimplify.cpp
@@ -25,6 +25,7 @@
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#define DEBUG_TYPE "region-simplify"
+#include "llvm/Support/Debug.h"
using namespace llvm;
@@ -156,6 +157,8 @@ void RegionSimplify::createSingleExitEdge(Region *R) {
if (R->contains(*PI))
Preds.push_back(*PI);
+ DEBUG(dbgs() << "Going to create single exit for:\n");
+ DEBUG(R->print(dbgs(), true, 0, Region::PrintRN));
BasicBlock *newExit = SplitBlockPredecessors(oldExit,
Preds.data(), Preds.size(),
".single_exit", this);
@@ -165,6 +168,7 @@ void RegionSimplify::createSingleExitEdge(Region *R) {
// this region and it affects only this region and all of its children.
// The new split node belongs to this region
RI->setRegionFor(newExit,R);
+ DEBUG(dbgs() << "Adding new exiting block: " << newExit->getName() << '\n');
// all children of this region whose exit is oldExit is changed to newExit
std::vector<Region *> RQ;
@@ -182,8 +186,12 @@ void RegionSimplify::createSingleExitEdge(Region *R) {
RQ.push_back(*RI);
R->replaceExit(newExit);
+ DEBUG(dbgs() << "Replacing exit for:\n");
+ DEBUG(R->print(dbgs(), true, 0, Region::PrintRN));
}
+ DEBUG(dbgs() << "After split exit:\n");
+ DEBUG(R->print(dbgs(), true, 0, Region::PrintRN));
}
bool RegionSimplify::runOnRegion(Region *R, RGPassManager &RGM) {