rename a function to indicate that it checks for profitability as well
[oota-llvm.git] / lib / Transforms / Scalar / LoopDeletion.cpp
index 4073a7775d27b68c5e8064207dce0e0cc992377b..86edcfaac80db122d3a914ffc5754d7c4dff475b 100644 (file)
@@ -30,7 +30,7 @@ namespace {
   class VISIBILITY_HIDDEN LoopDeletion : public LoopPass {
   public:
     static char ID; // Pass ID, replacement for typeid
-    LoopDeletion() : LoopPass((intptr_t)&ID) { }
+    LoopDeletion() : LoopPass(&ID) {}
     
     // Possibly eliminate loop L if it is dead.
     bool runOnLoop(Loop* L, LPPassManager& LPM);
@@ -60,7 +60,7 @@ namespace {
 char LoopDeletion::ID = 0;
 static RegisterPass<LoopDeletion> X("loop-deletion", "Delete dead loops");
 
-LoopPass* llvm::createLoopDeletionPass() {
+Pass* llvm::createLoopDeletionPass() {
   return new LoopDeletion();
 }
 
@@ -209,7 +209,7 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) {
     for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
          BI != BE; ) {
       Instruction* I = BI++;
-      if (I->getNumUses() > 0 && IsLoopInvariantInst(I, L))
+      if (!I->use_empty() && IsLoopInvariantInst(I, L))
         I->moveBefore(preheader->getTerminator());
     }
   
@@ -258,12 +258,8 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) {
   // NOTE: This iteration is safe because erasing the block does not remove its
   // entry from the loop's block list.  We do that in the next section.
   for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
-       LI != LE; ++LI) {
-    for (Value::use_iterator UI = (*LI)->use_begin(), UE = (*LI)->use_end();
-         UI != UE; ++UI)
-      (*UI)->dump();
+       LI != LE; ++LI)
     (*LI)->eraseFromParent();
-  }
   
   // Finally, the blocks from loopinfo.  This has to happen late because
   // otherwise our loop iterators won't work.