diff --git a/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp b/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp index c14b50120b16e..a04b6e4c061a7 100644 --- a/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp +++ b/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp @@ -1793,8 +1793,7 @@ bool ComplexDeinterleavingGraph::checkNodes() { // Extract all instructions that are used by all XCMLA/XCADD/ADD/SUB/NEG // chains while (!Worklist.empty()) { - auto *I = Worklist.back(); - Worklist.pop_back(); + auto *I = Worklist.pop_back_val(); if (!AllInstructions.insert(I).second) continue; @@ -1828,8 +1827,7 @@ bool ComplexDeinterleavingGraph::checkNodes() { // that somehow connect to those instructions. SmallPtrSet Visited; while (!Worklist.empty()) { - auto *I = Worklist.back(); - Worklist.pop_back(); + auto *I = Worklist.pop_back_val(); if (!Visited.insert(I).second) continue; diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp index 2ea99e332cbda..36e2156165f49 100644 --- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -854,8 +854,7 @@ void TwoAddressInstructionImpl::scanUses(Register DstReg) { } if (!VirtRegPairs.empty()) { - Register ToReg = VirtRegPairs.back(); - VirtRegPairs.pop_back(); + Register ToReg = VirtRegPairs.pop_back_val(); while (!VirtRegPairs.empty()) { Register FromReg = VirtRegPairs.pop_back_val(); bool isNew = DstRegMap.insert(std::make_pair(FromReg, ToReg)).second; diff --git a/llvm/lib/Support/SuffixTree.cpp b/llvm/lib/Support/SuffixTree.cpp index b2e606c86dd57..daf66108657b3 100644 --- a/llvm/lib/Support/SuffixTree.cpp +++ b/llvm/lib/Support/SuffixTree.cpp @@ -306,8 +306,7 @@ void SuffixTree::RepeatedSubstringIterator::advance() { // Continue visiting nodes until we find one which repeats more than once. while (!InternalNodesToVisit.empty()) { RepeatedSubstringStarts.clear(); - auto *Curr = InternalNodesToVisit.back(); - InternalNodesToVisit.pop_back(); + auto *Curr = InternalNodesToVisit.pop_back_val(); // Keep track of the length of the string associated with the node. If // it's too short, we'll quit. diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 17a35c66c5966..6407f48dc2c05 100644 --- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -1528,8 +1528,7 @@ bool MemCpyOptPass::performStackMoveOptzn(Instruction *Load, Instruction *Store, Worklist.reserve(MaxUsesToExplore); SmallSet Visited; while (!Worklist.empty()) { - Instruction *I = Worklist.back(); - Worklist.pop_back(); + Instruction *I = Worklist.pop_back_val(); for (const Use &U : I->uses()) { auto *UI = cast(U.getUser()); // If any use that isn't dominated by SrcAlloca exists, we move src diff --git a/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp b/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp index ecf71b6056f2a..0e076c60d6085 100644 --- a/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp +++ b/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp @@ -464,8 +464,7 @@ bool llvm::nonStrictlyPostDominate(const BasicBlock *ThisBlock, SmallPtrSet Visited; WorkList.push_back(ThisBlock); while (!WorkList.empty()) { - const BasicBlock *CurBlock = WorkList.back(); - WorkList.pop_back(); + const BasicBlock *CurBlock = WorkList.pop_back_val(); Visited.insert(CurBlock); if (PDT->dominates(CurBlock, OtherBlock)) return true;