diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td --- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td +++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td @@ -167,7 +167,7 @@ def Bufferization_CloneOp : Bufferization_Op<"clone", [ CopyOpInterface, - DeclareOpInterfaceMethods, + MemoryEffectsOpInterface, DeclareOpInterfaceMethods ]> { let builders = [ @@ -191,8 +191,11 @@ behavior. }]; - let arguments = (ins Arg:$input); - let results = (outs Arg:$output); + let arguments = (ins Arg]>:$input); + let results = (outs Res, + MemAlloc]>:$output); let extraClassDeclaration = [{ Value getSource() { return getInput(); } diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp --- a/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp +++ b/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp @@ -489,17 +489,6 @@ // CloneOp //===----------------------------------------------------------------------===// -void CloneOp::getEffects( - SmallVectorImpl> - &effects) { - effects.emplace_back(MemoryEffects::Read::get(), getInput(), - SideEffects::DefaultResource::get()); - effects.emplace_back(MemoryEffects::Write::get(), getOutput(), - SideEffects::DefaultResource::get()); - effects.emplace_back(MemoryEffects::Allocate::get(), getOutput(), - SideEffects::DefaultResource::get()); -} - OpFoldResult CloneOp::fold(FoldAdaptor adaptor) { return succeeded(memref::foldMemRefCast(*this)) ? getResult() : Value(); }