[Mlir-commits] [mlir] [mlir][EmitC] Expand the MemRefToEmitC pass - Lowering `CopyOp` (PR #151206)

Paul Kirth llvmlistbot at llvm.org
Thu Aug 7 08:39:40 PDT 2025


================
@@ -0,0 +1,30 @@
+// RUN: mlir-opt -convert-memref-to-emitc="lower-to-cpp=true" %s -split-input-file | FileCheck %s --check-prefix=CPP
+// RUN: mlir-opt -convert-memref-to-emitc="lower-to-cpp=false" %s -split-input-file | FileCheck %s --check-prefix=NOCPP
+
+
+func.func @alloc_copy(%arg0: memref<999xi32>) {
+  %alloc = memref.alloc() : memref<999xi32>
+  memref.copy %arg0, %alloc : memref<999xi32> to memref<999xi32>
+  return
+} 
+
+// NOCPP: module {
+// NOCPP-NEXT:  emitc.include <"string.h">
+// NOCPP-NEXT:  emitc.include <"stdlib.h">
+
+// CPP: module {
+// CPP-NEXT:  emitc.include <"cstring">
+// CPP-NEXT:  emitc.include <"cstdlib">
----------------
ilovepi wrote:

```suggestion
// CHECK: module {
// NOCPP:  emitc.include <"string.h">
// NOCPP-NEXT:  emitc.include <"stdlib.h">

// CPP:  emitc.include <"cstring">
// CPP-NEXT:  emitc.include <"cstdlib">
```

https://github.com/llvm/llvm-project/pull/151206


More information about the Mlir-commits mailing list