[Mlir-commits] [mlir] Avoid copies in getChecked (PR #147721)

Alexandru Lorinti llvmlistbot at llvm.org
Wed Jul 9 06:16:17 PDT 2025


https://github.com/AlexandruLorinti created https://github.com/llvm/llvm-project/pull/147721

Amending https://github.com/llvm/llvm-project/pull/68067 ; adding std::move to getChecked method as well.

>From 7438259dbe50c0b36137b74df0df7ca34f33fea9 Mon Sep 17 00:00:00 2001
From: Alexandru Lorinti <alexandru.lorinti at intel.com>
Date: Wed, 9 Jul 2025 16:12:20 +0300
Subject: [PATCH] avoid copies

---
 mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
index d9aa901ee2b28..5f6e7e7d4ab35 100644
--- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
+++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
@@ -495,7 +495,7 @@ void DefGen::emitCheckedBuilder() {
   MethodBody &body = m->body().indent();
   auto scope = body.scope("return Base::getChecked(emitError, context", ");");
   for (const auto &param : params)
-    body << ", " << param.getName();
+    body << ", std::move(" << param.getName() << ")";
 }
 
 static SmallVector<MethodParameter>



More information about the Mlir-commits mailing list