[llvm-commits] [llvm] r60464 - in /llvm/trunk: include/llvm/Transforms/Utils/BasicBlockUtils.h lib/Transforms/Utils/BasicBlockUtils.cpp lib/Transforms/Utils/SimplifyCFG.cpp
Chris Lattner
sabre at nondot.org
Tue Dec 2 22:40:52 PST 2008
Author: lattner
Date: Wed Dec 3 00:40:52 2008
New Revision: 60464
URL: http://llvm.org/viewvc/llvm-project?rev=60464&view=rev
Log:
Rename DeleteBlockIfDead to DeleteDeadBlock and make it
unconditionally delete the block. All likely clients will
do the checking anyway.
Modified:
llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h?rev=60464&r1=60463&r2=60464&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h Wed Dec 3 00:40:52 2008
@@ -26,10 +26,9 @@
class Pass;
class AliasAnalysis;
-/// 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 DeleteBlockIfDead(BasicBlock *BB);
+/// DeleteDeadBlock - Delete the specified block, which must have no
+/// predecessors.
+void DeleteDeadBlock(BasicBlock *BB);
/// MergeBlockIntoPredecessor - Attempts to merge a block into its predecessor,
/// if possible. The return value indicates success or failure.
Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=60464&r1=60463&r2=60464&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Wed Dec 3 00:40:52 2008
@@ -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 @@
// Zap the block!
BB->eraseFromParent();
- return true;
}
/// MergeBlockIntoPredecessor - Attempts to merge a block into its predecessor,
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=60464&r1=60463&r2=60464&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Wed Dec 3 00:40:52 2008
@@ -1681,7 +1681,7 @@
// 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;
}
More information about the llvm-commits
mailing list