Enhance the TD pass to build composite graphs when we have indirect call
[oota-llvm.git] / lib / Analysis / LoopInfo.cpp
index 131d02a32b8c10633eeb5739413b681f40da68a1..156d8b1bace4092a71cc64a2b83bcb797d889911 100644 (file)
@@ -20,7 +20,7 @@
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Support/CFG.h"
-#include "Support/DepthFirstIterator.h"
+#include "llvm/ADT/DepthFirstIterator.h"
 #include <algorithm>
 #include <iostream>
 
@@ -33,7 +33,7 @@ X("loops", "Natural Loop Construction", true);
 // Loop implementation
 //
 bool Loop::contains(const BasicBlock *BB) const {
-  return find(Blocks.begin(), Blocks.end(), BB) != Blocks.end();
+  return std::find(Blocks.begin(), Blocks.end(), BB) != Blocks.end();
 }
 
 bool Loop::isLoopExit(const BasicBlock *BB) const {
@@ -119,7 +119,7 @@ void LoopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addRequired<DominatorSet>();
 }
 
-void LoopInfo::print(std::ostream &OS) const {
+void LoopInfo::print(std::ostream &OS, const Module* ) const {
   for (unsigned i = 0; i < TopLevelLoops.size(); ++i)
     TopLevelLoops[i]->print(OS);
 #if 0
@@ -404,15 +404,15 @@ PHINode *Loop::getCanonicalInductionVariable() const {
     return 0;
 
   // Loop over all of the PHI nodes, looking for a canonical indvar.
-  for (BasicBlock::iterator I = H->begin();
-       PHINode *PN = dyn_cast<PHINode>(I); ++I)
+  for (BasicBlock::iterator I = H->begin(); isa<PHINode>(I); ++I) {
+    PHINode *PN = cast<PHINode>(I);
     if (Instruction *Inc =
         dyn_cast<Instruction>(PN->getIncomingValueForBlock(Backedge)))
       if (Inc->getOpcode() == Instruction::Add && Inc->getOperand(0) == PN)
         if (ConstantInt *CI = dyn_cast<ConstantInt>(Inc->getOperand(1)))
           if (CI->equalsInt(1))
             return PN;
-
+  }
   return 0;
 }