Skip to content

[llvm] Use llvm::SmallVector::pop_back_val (NFC) #136533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Apr 21, 2025

@llvm/pr-subscribers-llvm-support

@llvm/pr-subscribers-llvm-regalloc

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/136533.diff

3 Files Affected:

  • (modified) llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp (+1-2)
  • (modified) llvm/lib/CodeGen/SplitKit.cpp (+1-2)
  • (modified) llvm/lib/Support/SuffixTree.cpp (+1-2)
diff --git a/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp b/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
index a04b6e4c061a7..790edf12b46be 100644
--- a/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
+++ b/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
@@ -1151,8 +1151,7 @@ ComplexDeinterleavingGraph::identifyReassocNodes(Instruction *Real,
     SmallVector<PointerIntPair<Value *, 1, bool>> Worklist = {{Insn, true}};
     SmallPtrSet<Value *, 8> Visited;
     while (!Worklist.empty()) {
-      auto [V, IsPositive] = Worklist.back();
-      Worklist.pop_back();
+      auto [V, IsPositive] = Worklist.pop_back_val();
       if (!Visited.insert(V).second)
         continue;
 
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp
index e55dfaebd028e..f118ee521925f 100644
--- a/llvm/lib/CodeGen/SplitKit.cpp
+++ b/llvm/lib/CodeGen/SplitKit.cpp
@@ -1519,8 +1519,7 @@ void SplitEditor::forceRecomputeVNI(const VNInfo &ParentVNI) {
   const LiveInterval &ParentLI = Edit->getParent();
   const SlotIndexes &Indexes = *LIS.getSlotIndexes();
   do {
-    const VNInfo &VNI = *WorkList.back();
-    WorkList.pop_back();
+    const VNInfo &VNI = *WorkList.pop_back_val();
     for (unsigned I = 0, E = Edit->size(); I != E; ++I)
       forceRecompute(I, VNI);
     if (!VNI.isPHIDef())
diff --git a/llvm/lib/Support/SuffixTree.cpp b/llvm/lib/Support/SuffixTree.cpp
index daf66108657b3..a31287836e860 100644
--- a/llvm/lib/Support/SuffixTree.cpp
+++ b/llvm/lib/Support/SuffixTree.cpp
@@ -95,8 +95,7 @@ void SuffixTree::setSuffixIndices() {
   unsigned CurrNodeLen = 0;
   ToVisit.push_back({CurrNode, CurrNodeLen});
   while (!ToVisit.empty()) {
-    std::tie(CurrNode, CurrNodeLen) = ToVisit.back();
-    ToVisit.pop_back();
+    std::tie(CurrNode, CurrNodeLen) = ToVisit.pop_back_val();
     // Length of the current node from the root down to here.
     CurrNode->setConcatLen(CurrNodeLen);
     if (auto *InternalNode = dyn_cast<SuffixTreeInternalNode>(CurrNode))

@kazutakahirata kazutakahirata merged commit cfc2b0d into llvm:main Apr 21, 2025
14 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_SmallVector_pop_back_val_llvm branch April 21, 2025 15:13
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants