Simplify code by using SmallVector's pop_back_val() instead of
separate back() and pop_back() calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71089 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Utils/CloneLoop.cpp b/lib/Transforms/Utils/CloneLoop.cpp
index a0306ff..7e000a1 100644
--- a/lib/Transforms/Utils/CloneLoop.cpp
+++ b/lib/Transforms/Utils/CloneLoop.cpp
@@ -92,8 +92,7 @@
 
   Loop *NewParentLoop = NULL;
   while (!LoopNest.empty()) {
-    Loop *L = LoopNest.back();
-    LoopNest.pop_back();
+    Loop *L = LoopNest.pop_back_val();
     Loop *NewLoop = new Loop();
 
     if (!NewParentLoop)
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp
index 4f2bb1e..94483b8 100644
--- a/lib/Transforms/Utils/Local.cpp
+++ b/lib/Transforms/Utils/Local.cpp
@@ -188,8 +188,7 @@
   DeadInsts.push_back(I);
   
   while (!DeadInsts.empty()) {
-    I = DeadInsts.back();
-    DeadInsts.pop_back();
+    I = DeadInsts.pop_back_val();
 
     // Null out all of the instruction's operands to see if any operand becomes
     // dead as we go.
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 1896be4..b717699 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -616,8 +616,7 @@
   // Now that we have a set of blocks where the phi is live-in, recursively add
   // their predecessors until we find the full region the value is live.
   while (!LiveInBlockWorklist.empty()) {
-    BasicBlock *BB = LiveInBlockWorklist.back();
-    LiveInBlockWorklist.pop_back();
+    BasicBlock *BB = LiveInBlockWorklist.pop_back_val();
     
     // The block really is live in here, insert it into the set.  If already in
     // the set, then it has already been processed.
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 1cbf91f..4435b13 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -742,8 +742,7 @@
 
   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 @@
       // 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 @@
       // 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()) &&