[Mlir-commits] [mlir] [mlir][EmitC] Expand the MemRefToEmitC pass - Lowering `CopyOp` (PR #151206)
Gil Rapaport
llvmlistbot at llvm.org
Thu Jul 31 07:37:14 PDT 2025
================
@@ -159,6 +182,55 @@ struct ConvertAlloc final : public OpConversionPattern<memref::AllocOp> {
}
};
+struct ConvertCopy final : public OpConversionPattern<memref::CopyOp> {
+ using OpConversionPattern::OpConversionPattern;
+
+ LogicalResult
+ matchAndRewrite(memref::CopyOp copyOp, OpAdaptor operands,
+ ConversionPatternRewriter &rewriter) const override {
+ Location loc = copyOp.getLoc();
+ MemRefType srcMemrefType =
+ dyn_cast<MemRefType>(copyOp.getSource().getType());
+ MemRefType targetMemrefType =
+ dyn_cast<MemRefType>(copyOp.getTarget().getType());
+
+ if (!isMemRefTypeLegalForEmitC(srcMemrefType) ||
+ !isMemRefTypeLegalForEmitC(targetMemrefType)) {
+ return rewriter.notifyMatchFailure(
+ loc, "incompatible memref type for EmitC conversion");
+ }
----------------
aniragil wrote:
I'd split this to two checks to specify in the message which memref was incompatible.
https://github.com/llvm/llvm-project/pull/151206
More information about the Mlir-commits
mailing list