Change the Dominator info and LoopInfo classes to keep track of BasicBlock's, not
const BasicBlocks


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2337 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index c34aef7..bf69172 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -18,7 +18,7 @@
 //===----------------------------------------------------------------------===//
 // cfg::Loop implementation
 //
-bool cfg::Loop::contains(const BasicBlock *BB) const {
+bool cfg::Loop::contains(BasicBlock *BB) const {
   return find(Blocks.begin(), Blocks.end(), BB) != Blocks.end();
 }
 
@@ -42,9 +42,9 @@
 }
 
 void cfg::LoopInfo::Calculate(const DominatorSet &DS) {
-  const BasicBlock *RootNode = DS.getRoot();
+  BasicBlock *RootNode = DS.getRoot();
 
-  for (df_iterator<const BasicBlock*> NI = df_begin(RootNode),
+  for (df_iterator<BasicBlock*> NI = df_begin(RootNode),
 	 NE = df_end(RootNode); NI != NE; ++NI)
     if (Loop *L = ConsiderForLoop(*NI, DS))
       TopLevelLoops.push_back(L);
@@ -60,15 +60,15 @@
 }
 
 
-cfg::Loop *cfg::LoopInfo::ConsiderForLoop(const BasicBlock *BB,
-					  const DominatorSet &DS) {
+cfg::Loop *cfg::LoopInfo::ConsiderForLoop(BasicBlock *BB,
+                                          const DominatorSet &DS) {
   if (BBMap.find(BB) != BBMap.end()) return 0;   // Havn't processed this node?
 
-  std::vector<const BasicBlock *> TodoStack;
+  std::vector<BasicBlock *> TodoStack;
 
   // Scan the predecessors of BB, checking to see if BB dominates any of
   // them.
-  for (pred_const_iterator I = pred_begin(BB), E = pred_end(BB); I != E; ++I)
+  for (pred_iterator I = pred_begin(BB), E = pred_end(BB); I != E; ++I)
     if (DS.dominates(BB, *I))   // If BB dominates it's predecessor...
       TodoStack.push_back(*I);
 
@@ -79,7 +79,7 @@
   BBMap[BB] = L;
 
   while (!TodoStack.empty()) {  // Process all the nodes in the loop
-    const BasicBlock *X = TodoStack.back();
+    BasicBlock *X = TodoStack.back();
     TodoStack.pop_back();
 
     if (!L->contains(X)) {                  // As of yet unprocessed??
@@ -94,7 +94,7 @@
   // loop can be found for them.  Also check subsidary basic blocks to see if
   // they start subloops of their own.
   //
-  for (std::vector<const BasicBlock*>::reverse_iterator I = L->Blocks.rbegin(),
+  for (std::vector<BasicBlock*>::reverse_iterator I = L->Blocks.rbegin(),
 	 E = L->Blocks.rend(); I != E; ++I) {
 
     // Check to see if this block starts a new loop