diff options
| author | Ramkumar Ramachandra <artagnon@gmail.com> | 2015-01-13 03:46:47 +0000 |
|---|---|---|
| committer | Ramkumar Ramachandra <artagnon@gmail.com> | 2015-01-13 03:46:47 +0000 |
| commit | 40c3e03e27c3c88b809ff1709fe3ebf571e93b4a (patch) | |
| tree | 6b2c0e310808a5c88f3f262462b99040ccfc030f /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
| parent | 26a3924a4f6b92598078e77e07584448ad5cd76d (diff) | |
| download | bcm5719-llvm-40c3e03e27c3c88b809ff1709fe3ebf571e93b4a.tar.gz bcm5719-llvm-40c3e03e27c3c88b809ff1709fe3ebf571e93b4a.zip | |
Standardize {pred,succ,use,user}_empty()
The functions {pred,succ,use,user}_{begin,end} exist, but many users
have to check *_begin() with *_end() by hand to determine if the
BasicBlock or User is empty. Fix this with a standard *_empty(),
demonstrating a few usecases.
llvm-svn: 225760
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 50ebdb77158..c8b6705ab5e 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -3020,7 +3020,7 @@ bool SimplifyCFGOpt::SimplifyReturn(ReturnInst *RI, IRBuilder<> &Builder) { } // If we eliminated all predecessors of the block, delete the block now. - if (pred_begin(BB) == pred_end(BB)) + if (pred_empty(BB)) // We know there are no successors, so just nuke the block. BB->eraseFromParent(); @@ -3193,7 +3193,7 @@ bool SimplifyCFGOpt::SimplifyUnreachable(UnreachableInst *UI) { } // If this block is now dead, remove it. - if (pred_begin(BB) == pred_end(BB) && + if (pred_empty(BB) && BB != &BB->getParent()->getEntryBlock()) { // We know there are no successors, so just nuke the block. BB->eraseFromParent(); @@ -4587,7 +4587,7 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) { // Remove basic blocks that have no predecessors (except the entry block)... // or that just have themself as a predecessor. These are unreachable. - if ((pred_begin(BB) == pred_end(BB) && + if ((pred_emtpy(BB) && BB != &BB->getParent()->getEntryBlock()) || BB->getSinglePredecessor() == BB) { DEBUG(dbgs() << "Removing BB: \n" << *BB); |

