[llvm] 0314755 - [llvm] Use llvm::SmallVector::pop_back_val (NFC) (#136441)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 19 11:49:22 PDT 2025
Author: Kazu Hirata
Date: 2025-04-19T11:49:19-07:00
New Revision: 031475594abd8a66b88a1687706651579e840421
URL: https://github.com/llvm/llvm-project/commit/031475594abd8a66b88a1687706651579e840421
DIFF: https://github.com/llvm/llvm-project/commit/031475594abd8a66b88a1687706651579e840421.diff
LOG: [llvm] Use llvm::SmallVector::pop_back_val (NFC) (#136441)
Added:
Modified:
llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
llvm/lib/Support/SuffixTree.cpp
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
Removed:
################################################################################
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<Instruction *, 16> 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<const Use *, 20> 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<Instruction>(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<const BasicBlock *, 8> 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;
More information about the llvm-commits
mailing list