aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/SimplifyCFG.cpp
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
commit5a5c9a5acd5f90ec3815f4871c66e224902588ce (patch)
tree123340bd14525ce17ac9d63acc11da48d7a542f0 /lib/Transforms/Utils/SimplifyCFG.cpp
parent3c4f8b91eff129f25327a03634da5386962b9d84 (diff)
simplify this code a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60164 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 596c5643e5..5c2f51442a 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/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;
}