summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-05-06 17:22:41 +0000
committerDan Gohman <gohman@apple.com>2009-05-06 17:22:41 +0000
commit9a6fef0a52e705f6ac0c4b181adb1b1948add802 (patch)
treefe20584b6777290b532b1c68b12f9350a65658e4 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parent164ac10f82c9e61189875afa051e4f9d48378a45 (diff)
downloadbcm5719-llvm-9a6fef0a52e705f6ac0c4b181adb1b1948add802.tar.gz
bcm5719-llvm-9a6fef0a52e705f6ac0c4b181adb1b1948add802.zip
Simplify code by using SmallVector's pop_back_val() instead of
separate back() and pop_back() calls. llvm-svn: 71089
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 1cbf91fd7a4..4435b13e00b 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -742,8 +742,7 @@ static bool FoldValueComparisonIntoPredecessors(TerminatorInst *TI) {
SmallVector<BasicBlock*, 16> Preds(pred_begin(BB), pred_end(BB));
while (!Preds.empty()) {
- BasicBlock *Pred = Preds.back();
- Preds.pop_back();
+ BasicBlock *Pred = Preds.pop_back_val();
// See if the predecessor is a comparison with the same value.
TerminatorInst *PTI = Pred->getTerminator();
@@ -1805,10 +1804,9 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
// If we found some, do the transformation!
if (!UncondBranchPreds.empty()) {
while (!UncondBranchPreds.empty()) {
- BasicBlock *Pred = UncondBranchPreds.back();
+ BasicBlock *Pred = UncondBranchPreds.pop_back_val();
DOUT << "FOLDING: " << *BB
<< "INTO UNCOND BRANCH PRED: " << *Pred;
- UncondBranchPreds.pop_back();
Instruction *UncondBranch = Pred->getTerminator();
// Clone the return and add it to the end of the predecessor.
Instruction *NewRet = RI->clone();
@@ -1847,8 +1845,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
// instruction. If any of them just select between returns, change the
// branch itself into a select/return pair.
while (!CondBranchPreds.empty()) {
- BranchInst *BI = CondBranchPreds.back();
- CondBranchPreds.pop_back();
+ BranchInst *BI = CondBranchPreds.pop_back_val();
// Check to see if the non-BB successor is also a return block.
if (isa<ReturnInst>(BI->getSuccessor(0)->getTerminator()) &&
OpenPOWER on IntegriCloud