[Mlir-commits] [mlir] [mlir] Use llvm::SmallVector::pop_back_val() (NFC) (PR #136452)

Kazu Hirata llvmlistbot at llvm.org
Sat Apr 19 12:38:44 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/136452

None

>From b967c3c1f7d96a2bd3ec50eb0cef5ae11b6eb18e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 19 Apr 2025 11:51:23 -0700
Subject: [PATCH] [mlir] Use llvm::SmallVector::pop_back_val() (NFC)

---
 mlir/lib/Analysis/Liveness.cpp | 3 +--
 mlir/lib/Rewrite/ByteCode.cpp  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/mlir/lib/Analysis/Liveness.cpp b/mlir/lib/Analysis/Liveness.cpp
index 3e39d974c0e21..3fcc0b5a6ffef 100644
--- a/mlir/lib/Analysis/Liveness.cpp
+++ b/mlir/lib/Analysis/Liveness.cpp
@@ -198,8 +198,7 @@ Liveness::OperationListT Liveness::resolveLiveness(Value value) const {
 
   while (!toProcess.empty()) {
     // Get block and block liveness information.
-    Block *block = toProcess.back();
-    toProcess.pop_back();
+    Block *block = toProcess.pop_back_val();
     const LivenessBlockInfo *blockInfo = getLiveness(block);
 
     // Note that start and end will be in the same block.
diff --git a/mlir/lib/Rewrite/ByteCode.cpp b/mlir/lib/Rewrite/ByteCode.cpp
index 26510f976efc9..17cb3a74184f1 100644
--- a/mlir/lib/Rewrite/ByteCode.cpp
+++ b/mlir/lib/Rewrite/ByteCode.cpp
@@ -1198,8 +1198,7 @@ class ByteCodeExecutor {
   /// Pops a code iterator from the stack, returning true on success.
   void popCodeIt() {
     assert(!resumeCodeIt.empty() && "attempt to pop code off empty stack");
-    curCodeIt = resumeCodeIt.back();
-    resumeCodeIt.pop_back();
+    curCodeIt = resumeCodeIt.pop_back_val();
   }
 
   /// Return the bytecode iterator at the start of the current op code.



More information about the Mlir-commits mailing list