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

Jakub Kuderski llvmlistbot at llvm.org
Wed Oct 22 08:46:00 PDT 2025


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

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.

>From 49ff0d720beda17ca7818be359df341057a84467 Mon Sep 17 00:00:00 2001
From: Jakub Kuderski <jakub at nod-labs.com>
Date: Wed, 22 Oct 2025 11:43:05 -0400
Subject: [PATCH] [mlir] Deprecate OpBuilder::create in favor of free functions

---
 mlir/include/mlir/IR/Builders.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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,



More information about the Mlir-commits mailing list