summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-27 07:54:38 +0000
committerChris Lattner <sabre@nondot.org>2008-11-27 07:54:38 +0000
commitd6204bed3d1dad085cc7030ef5920846afe758b5 (patch)
treeaf8e948c8d9795f7ed1e375d34acfb698040ec61 /llvm/lib
parent206250284da7745a6cd1fece6881ff592fa9cef9 (diff)
downloadbcm5719-llvm-d6204bed3d1dad085cc7030ef5920846afe758b5.tar.gz
bcm5719-llvm-d6204bed3d1dad085cc7030ef5920846afe758b5.zip
simplify this code a bit.
llvm-svn: 60164
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 596c5643e54..5c2f51442a1 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1709,9 +1709,9 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
assert(&BB->getParent()->getEntryBlock() != BB &&
"Can't Simplify entry block!");
- // Remove basic blocks that have no predecessors... which are unreachable.
- if ((pred_begin(BB) == pred_end(BB)) ||
- (*pred_begin(BB) == BB && ++pred_begin(BB) == pred_end(BB))) {
+ // Remove basic blocks that have no predecessors... or that just have themself
+ // as a predecessor. These are unreachable.
+ if (pred_begin(BB) == pred_end(BB) || BB->getSinglePredecessor() == BB) {
DOUT << "Removing BB: \n" << *BB;
// Loop through all of our successors and make sure they know that one
@@ -1733,7 +1733,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
// Remove the instruction from the basic block
BB->getInstList().pop_back();
}
- M->getBasicBlockList().erase(BB);
+ BB->eraseFromParent();
return true;
}
OpenPOWER on IntegriCloud