diff options
author | Chris Lattner <sabre@nondot.org> | 2008-12-03 06:40:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-12-03 06:40:52 +0000 |
commit | 7eb270ed0381c2408865f4a2677b6ed68ba6d8fa (patch) | |
tree | 530489be5677d78e634f3adcbf7468baff801741 /llvm/lib/Transforms | |
parent | bcc904a67c2f77b6a619d8ec9370af02e3a5ce02 (diff) | |
download | bcm5719-llvm-7eb270ed0381c2408865f4a2677b6ed68ba6d8fa.tar.gz bcm5719-llvm-7eb270ed0381c2408865f4a2677b6ed68ba6d8fa.zip |
Rename DeleteBlockIfDead to DeleteDeadBlock and make it
unconditionally delete the block. All likely clients will
do the checking anyway.
llvm-svn: 60464
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 2 |
2 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index bfcf375f51a..9452e6e8778 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -24,14 +24,10 @@ #include <algorithm> using namespace llvm; -/// DeleteBlockIfDead - If the specified basic block is trivially dead (has no -/// predecessors and not the entry block), delete it and return true. Otherwise -/// return false. -bool llvm::DeleteBlockIfDead(BasicBlock *BB) { - if (pred_begin(BB) != pred_end(BB) || - BB == &BB->getParent()->getEntryBlock()) - return false; - +/// DeleteDeadBlock - Delete the specified block, which must have no +/// predecessors. +void llvm::DeleteDeadBlock(BasicBlock *BB) { + assert(pred_begin(BB) != pred_end(BB) && "Block is not dead!"); TerminatorInst *BBTerm = BB->getTerminator(); // Loop through all of our successors and make sure they know that one @@ -54,7 +50,6 @@ bool llvm::DeleteBlockIfDead(BasicBlock *BB) { // Zap the block! BB->eraseFromParent(); - return true; } /// MergeBlockIntoPredecessor - Attempts to merge a block into its predecessor, diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 7077436a1dd..f4faeb3deb5 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1681,7 +1681,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { // as a predecessor. These are unreachable. if (pred_begin(BB) == pred_end(BB) || BB->getSinglePredecessor() == BB) { DOUT << "Removing BB: \n" << *BB; - DeleteBlockIfDead(BB); + DeleteDeadBlock(BB); return true; } |