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);
char LoopDeletion::ID = 0;
static RegisterPass<LoopDeletion> X("loop-deletion", "Delete dead loops");
-LoopPass* llvm::createLoopDeletionPass() {
+Pass* llvm::createLoopDeletionPass() {
return new LoopDeletion();
}
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());
}
// 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.