[Mlir-commits] [mlir] [mlir][IR] Deprecate `OpBuilder::create` in favor of free functions (PR #164649)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 22 08:46:50 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Jakub Kuderski (kuhar)

<details>
<summary>Changes</summary>

These have been soft-deprecated since July: https://discourse.llvm.org/t/psa-opty-create-now-with-100-more-tab-complete/87339

Add a deprecation attribute to prevent new uses from creeping in.

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


1 Files Affected:

- (modified) mlir/include/mlir/IR/Builders.h (+3-2) 


``````````diff
diff --git a/mlir/include/mlir/IR/Builders.h b/mlir/include/mlir/IR/Builders.h
index 9205f16f97bbb..3ba6818204ba0 100644
--- a/mlir/include/mlir/IR/Builders.h
+++ b/mlir/include/mlir/IR/Builders.h
@@ -502,6 +502,7 @@ class OpBuilder : public Builder {
 public:
   /// Create an operation of specific op type at the current insertion point.
   template <typename OpTy, typename... Args>
+  [[deprecated("Use OpTy::create instead")]]
   OpTy create(Location location, Args &&...args) {
     OperationState state(location,
                          getCheckRegisteredInfo<OpTy>(location.getContext()));
@@ -517,9 +518,9 @@ class OpBuilder : public Builder {
   /// the results of the operation.
   ///
   /// Note: This performs opportunistic eager folding during IR construction.
-  /// The folders are designed to operate efficiently on canonical IR, which 
+  /// The folders are designed to operate efficiently on canonical IR, which
   /// this API does not enforce. Complete folding isn't only expected in the
-  /// context of canonicalization which intertwine folders with pattern 
+  /// context of canonicalization which intertwine folders with pattern
   /// rewrites until fixed-point.
   template <typename OpTy, typename... Args>
   void createOrFold(SmallVectorImpl<Value> &results, Location location,

``````````

</details>


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


More information about the Mlir-commits mailing list