[Mlir-commits] [mlir] [MLIR] Forward generated OpTy::create arguments (PR #170012)

Mehdi Amini llvmlistbot at llvm.org
Mon Dec 1 02:07:24 PST 2025


================
@@ -235,14 +235,14 @@ def NS_FOp : NS_Op<"op_with_all_types_constraint",
 
 // DEFS: FOp FOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value a) {
 // DEFS:   ::mlir::OperationState __state__(location, getOperationName());
-// DEFS:   build(builder, __state__, a);
+// DEFS:   build(builder, __state__, static_cast<decltype(a)>(a));
----------------
joker-eph wrote:

I would think that the idiomatic way would be to std::move here?

Taking the snippet from the PR description:

```
  let builders = [ 
    OpBuilder<(ins "::mlir::Value":$cdr,
                   "::mlir::ValueRange":$packs,
                   "std::unique_ptr<::mlir::Region>&&":$body)>
  ];
  ```

I would instead write this builder as:

```
  let builders = [ 
    OpBuilder<(ins "::mlir::Value":$cdr,
                   "::mlir::ValueRange":$packs,
                   "std::unique_ptr<::mlir::Region>":$body)>
  ];
  ```

That is, taking the `unique_ptr` by value and relying on the move.


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


More information about the Mlir-commits mailing list