[Mlir-commits] [mlir] [MLIR] Remove CopyOpInterface (PR #157711)

Mehdi Amini llvmlistbot at llvm.org
Tue Sep 9 09:54:42 PDT 2025


https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/157711

This interface isn't used anywhere anymore.

>From 3c858709dabf20a8b2e0cca6755447f0fa8f47b7 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Tue, 9 Sep 2025 09:53:35 -0700
Subject: [PATCH] [MLIR] Remove CopyOpInterface

This interface isn't used anywhere anymore.
---
 .../Dialect/Bufferization/IR/Bufferization.h  |  1 -
 .../Bufferization/IR/BufferizationOps.td      |  2 -
 mlir/include/mlir/Dialect/Linalg/IR/Linalg.h  |  1 -
 mlir/include/mlir/Dialect/MemRef/IR/MemRef.h  |  1 -
 .../mlir/Dialect/MemRef/IR/MemRefOps.td       |  3 +-
 mlir/include/mlir/Interfaces/CMakeLists.txt   |  1 -
 .../include/mlir/Interfaces/CopyOpInterface.h | 21 ----------
 .../mlir/Interfaces/CopyOpInterface.td        | 38 -------------------
 mlir/lib/Interfaces/CMakeLists.txt            |  2 -
 mlir/lib/Interfaces/CopyOpInterface.cpp       | 18 ---------
 mlir/test/lib/Dialect/Test/TestDialect.h      |  1 -
 mlir/test/lib/Dialect/Test/TestOps.h          |  1 -
 mlir/test/lib/Dialect/Test/TestOps.td         |  5 +--
 13 files changed, 3 insertions(+), 92 deletions(-)
 delete mode 100644 mlir/include/mlir/Interfaces/CopyOpInterface.h
 delete mode 100644 mlir/include/mlir/Interfaces/CopyOpInterface.td
 delete mode 100644 mlir/lib/Interfaces/CopyOpInterface.cpp

diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h b/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h
index 1ef5370802953..e735651d5366d 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h
@@ -12,7 +12,6 @@
 #include "mlir/Bytecode/BytecodeOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/AllocationOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
-#include "mlir/Interfaces/CopyOpInterface.h"
 #include "mlir/Interfaces/DestinationStyleOpInterface.h"
 #include "mlir/Interfaces/InferTypeOpInterface.h"
 #include "mlir/Interfaces/SubsetOpInterface.h"
diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
index 271b42025e0af..6724d4c483101 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
@@ -18,7 +18,6 @@ include "mlir/Interfaces/DestinationStyleOpInterface.td"
 include "mlir/Interfaces/InferTypeOpInterface.td"
 include "mlir/Interfaces/SideEffectInterfaces.td"
 include "mlir/Interfaces/SubsetOpInterface.td"
-include "mlir/Interfaces/CopyOpInterface.td"
 
 class Bufferization_Op<string mnemonic, list<Trait> traits = []>
     : Op<Bufferization_Dialect, mnemonic, traits>;
@@ -171,7 +170,6 @@ def Bufferization_AllocTensorOp : Bufferization_Op<"alloc_tensor",
 //===----------------------------------------------------------------------===//
 
 def Bufferization_CloneOp : Bufferization_Op<"clone", [
-    CopyOpInterface,
     MemoryEffectsOpInterface,
     DeclareOpInterfaceMethods<AllocationOpInterface, ["buildDealloc", "buildClone"]>
   ]> {
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/Linalg.h b/mlir/include/mlir/Dialect/Linalg/IR/Linalg.h
index eb4e3810f0d07..9de6d8fd50983 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/Linalg.h
+++ b/mlir/include/mlir/Dialect/Linalg/IR/Linalg.h
@@ -22,7 +22,6 @@
 #include "mlir/IR/ImplicitLocOpBuilder.h"
 #include "mlir/IR/TypeUtilities.h"
 #include "mlir/Interfaces/ControlFlowInterfaces.h"
-#include "mlir/Interfaces/CopyOpInterface.h"
 #include "mlir/Interfaces/DestinationStyleOpInterface.h"
 #include "mlir/Interfaces/InferTypeOpInterface.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
index ac383ab46e7a5..bdec699eb4ce4 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
@@ -16,7 +16,6 @@
 #include "mlir/Interfaces/CallInterfaces.h"
 #include "mlir/Interfaces/CastInterfaces.h"
 #include "mlir/Interfaces/ControlFlowInterfaces.h"
-#include "mlir/Interfaces/CopyOpInterface.h"
 #include "mlir/Interfaces/InferIntRangeInterface.h"
 #include "mlir/Interfaces/InferTypeOpInterface.h"
 #include "mlir/Interfaces/MemorySlotInterfaces.h"
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
index d6b7a97179b71..513a9a18198a3 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -13,7 +13,6 @@ include "mlir/Dialect/Arith/IR/ArithBase.td"
 include "mlir/Dialect/MemRef/IR/MemRefBase.td"
 include "mlir/Interfaces/CastInterfaces.td"
 include "mlir/Interfaces/ControlFlowInterfaces.td"
-include "mlir/Interfaces/CopyOpInterface.td"
 include "mlir/Interfaces/InferIntRangeInterface.td"
 include "mlir/Interfaces/InferTypeOpInterface.td"
 include "mlir/Interfaces/MemorySlotInterfaces.td"
@@ -530,7 +529,7 @@ def MemRef_CastOp : MemRef_Op<"cast", [
 // CopyOp
 //===----------------------------------------------------------------------===//
 
-def CopyOp : MemRef_Op<"copy", [CopyOpInterface, SameOperandsElementType,
+def CopyOp : MemRef_Op<"copy", [SameOperandsElementType,
     SameOperandsShape]> {
 
   let description = [{
diff --git a/mlir/include/mlir/Interfaces/CMakeLists.txt b/mlir/include/mlir/Interfaces/CMakeLists.txt
index 20cc2674d6fbc..2add220fdfb7c 100644
--- a/mlir/include/mlir/Interfaces/CMakeLists.txt
+++ b/mlir/include/mlir/Interfaces/CMakeLists.txt
@@ -1,7 +1,6 @@
 add_mlir_interface(CallInterfaces)
 add_mlir_interface(CastInterfaces)
 add_mlir_interface(ControlFlowInterfaces)
-add_mlir_interface(CopyOpInterface)
 add_mlir_interface(DerivedAttributeOpInterface)
 add_mlir_interface(DestinationStyleOpInterface)
 add_mlir_interface(FunctionInterfaces)
diff --git a/mlir/include/mlir/Interfaces/CopyOpInterface.h b/mlir/include/mlir/Interfaces/CopyOpInterface.h
deleted file mode 100644
index 2f38eb326b53e..0000000000000
--- a/mlir/include/mlir/Interfaces/CopyOpInterface.h
+++ /dev/null
@@ -1,21 +0,0 @@
-//===- CopyOpInterface.h - copy operations interface ----------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the operation interface for copy-like operations.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MLIR_INTERFACES_COPYOPINTERFACE_H_
-#define MLIR_INTERFACES_COPYOPINTERFACE_H_
-
-#include "mlir/IR/OpDefinition.h"
-
-/// Include the generated interface declarations.
-#include "mlir/Interfaces/CopyOpInterface.h.inc"
-
-#endif // MLIR_INTERFACES_COPYOPINTERFACE_H_
diff --git a/mlir/include/mlir/Interfaces/CopyOpInterface.td b/mlir/include/mlir/Interfaces/CopyOpInterface.td
deleted file mode 100644
index f6c5a6f8bb810..0000000000000
--- a/mlir/include/mlir/Interfaces/CopyOpInterface.td
+++ /dev/null
@@ -1,38 +0,0 @@
-//===- CopyOpInterface.td - Copy operation interface -------*- tablegen -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// Defines the interface for copy-like operations.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MLIR_INTERFACES_COPYOPINTERFACE
-#define MLIR_INTERFACES_COPYOPINTERFACE
-
-include "mlir/IR/OpBase.td"
-
-def CopyOpInterface : OpInterface<"CopyOpInterface"> {
-  let description = [{
-    A copy-like operation is one that copies from source value to target value.
-  }];
-  let cppNamespace = "::mlir";
-
-  let methods = [
-    InterfaceMethod<
-      /*desc=*/"Returns the source value for this copy operation",
-      /*retTy=*/"::mlir::Value",
-      /*methodName=*/"getSource"
-    >,
-    InterfaceMethod<
-      /*desc=*/"Returns the target value for this copy operation",
-      /*retTy=*/"::mlir::Value",
-      /*methodName=*/"getTarget"
-    >
-  ];
-}
-
-#endif // MLIR_INTERFACES_COPYOPINTERFACE
diff --git a/mlir/lib/Interfaces/CMakeLists.txt b/mlir/lib/Interfaces/CMakeLists.txt
index af923d98c76ff..fdc19844702bc 100644
--- a/mlir/lib/Interfaces/CMakeLists.txt
+++ b/mlir/lib/Interfaces/CMakeLists.txt
@@ -2,7 +2,6 @@ set(LLVM_OPTIONAL_SOURCES
   CallInterfaces.cpp
   CastInterfaces.cpp
   ControlFlowInterfaces.cpp
-  CopyOpInterface.cpp
   DataLayoutInterfaces.cpp
   DerivedAttributeOpInterface.cpp
   DestinationStyleOpInterface.cpp
@@ -43,7 +42,6 @@ endfunction(add_mlir_interface_library)
 add_mlir_interface_library(CallInterfaces)
 add_mlir_interface_library(CastInterfaces)
 add_mlir_interface_library(ControlFlowInterfaces)
-add_mlir_interface_library(CopyOpInterface)
 add_mlir_interface_library(DataLayoutInterfaces)
 add_mlir_interface_library(DerivedAttributeOpInterface)
 add_mlir_interface_library(DestinationStyleOpInterface)
diff --git a/mlir/lib/Interfaces/CopyOpInterface.cpp b/mlir/lib/Interfaces/CopyOpInterface.cpp
deleted file mode 100644
index 8e6132ca14e91..0000000000000
--- a/mlir/lib/Interfaces/CopyOpInterface.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//===- CopyOpInterface.cpp - Copy operations interface in MLIR ------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "mlir/Interfaces/CopyOpInterface.h"
-
-using namespace mlir;
-
-//===----------------------------------------------------------------------===//
-// CopyOp Interface
-//===----------------------------------------------------------------------===//
-
-/// Include the definitions of the copy operation interface.
-#include "mlir/Interfaces/CopyOpInterface.cpp.inc"
diff --git a/mlir/test/lib/Dialect/Test/TestDialect.h b/mlir/test/lib/Dialect/Test/TestDialect.h
index c05e15fc642a2..f2adca6310d78 100644
--- a/mlir/test/lib/Dialect/Test/TestDialect.h
+++ b/mlir/test/lib/Dialect/Test/TestDialect.h
@@ -35,7 +35,6 @@
 #include "mlir/IR/SymbolTable.h"
 #include "mlir/Interfaces/CallInterfaces.h"
 #include "mlir/Interfaces/ControlFlowInterfaces.h"
-#include "mlir/Interfaces/CopyOpInterface.h"
 #include "mlir/Interfaces/DerivedAttributeOpInterface.h"
 #include "mlir/Interfaces/InferIntRangeInterface.h"
 #include "mlir/Interfaces/InferTypeOpInterface.h"
diff --git a/mlir/test/lib/Dialect/Test/TestOps.h b/mlir/test/lib/Dialect/Test/TestOps.h
index b414b47c87425..4201ade9795e7 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.h
+++ b/mlir/test/lib/Dialect/Test/TestOps.h
@@ -33,7 +33,6 @@
 #include "mlir/IR/SymbolTable.h"
 #include "mlir/Interfaces/CallInterfaces.h"
 #include "mlir/Interfaces/ControlFlowInterfaces.h"
-#include "mlir/Interfaces/CopyOpInterface.h"
 #include "mlir/Interfaces/DerivedAttributeOpInterface.h"
 #include "mlir/Interfaces/InferIntRangeInterface.h"
 #include "mlir/Interfaces/InferTypeOpInterface.h"
diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index 231400ec9cd29..5564264ed8b0b 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -23,7 +23,6 @@ include "mlir/IR/RegionKindInterface.td"
 include "mlir/IR/SymbolInterfaces.td"
 include "mlir/Interfaces/CallInterfaces.td"
 include "mlir/Interfaces/ControlFlowInterfaces.td"
-include "mlir/Interfaces/CopyOpInterface.td"
 include "mlir/Interfaces/DataLayoutInterfaces.td"
 include "mlir/Interfaces/DestinationStyleOpInterface.td"
 include "mlir/Interfaces/InferIntRangeInterface.td"
@@ -2322,10 +2321,10 @@ def SideEffectWithRegionOp : TEST_Op<"side_effect_with_region_op",
 }
 
 //===----------------------------------------------------------------------===//
-// Test CopyOpInterface
+// Copy Operation Test 
 //===----------------------------------------------------------------------===//
 
-def CopyOp : TEST_Op<"copy", [CopyOpInterface]> {
+def CopyOp : TEST_Op<"copy", []> {
   let description = [{
     Represents a copy operation.
   }];



More information about the Mlir-commits mailing list