Skip to content

Conversation

@matthias-springer
Copy link
Member

Accessing an erased operation will no longer work during a One-Shot Dialect Conversion.

Accessing an erased operation will no longer work during a One-Shot Dialect Conversion.
@llvmbot
Copy link
Member

llvmbot commented Jul 3, 2025

@llvm/pr-subscribers-mlir

Author: Matthias Springer (matthias-springer)

Changes

Accessing an erased operation will no longer work during a One-Shot Dialect Conversion.


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

1 Files Affected:

  • (modified) mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp (+1-1)
diff --git a/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp b/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
index 0b5a5d8e71063..1d253632bb5a1 100644
--- a/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
+++ b/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
@@ -111,8 +111,8 @@ struct CloneOpConversion : public OpConversionPattern<bufferization::CloneOp> {
             rewriter.create<memref::CastOp>(op->getLoc(), memrefType, alloc);
     }
 
-    rewriter.replaceOp(op, alloc);
     rewriter.create<memref::CopyOp>(loc, op.getInput(), alloc);
+    rewriter.replaceOp(op, alloc);
     return success();
   }
 };

@matthias-springer matthias-springer merged commit 51485ab into main Jul 3, 2025
10 of 11 checks passed
@matthias-springer matthias-springer deleted the users/matthias-springer/bufferization_erase_later branch July 3, 2025 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants