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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jul 9 06:18:19 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-core

Author: Alexandru Lorinti (AlexandruLorinti)

<details>
<summary>Changes</summary>

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

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


1 Files Affected:

- (modified) mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp (+1-1) 


``````````diff
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>

``````````

</details>


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


More information about the Mlir-commits mailing list