[flang-commits] [flang] [flang] introduce fir.copy to avoid load store of aggregates (PR #130289)

via flang-commits flang-commits at lists.llvm.org
Mon Mar 10 05:02:50 PDT 2025


================
@@ -342,6 +342,44 @@ def fir_StoreOp : fir_Op<"store", [FirAliasTagOpInterface]> {
   }];
 }
 
+def fir_CopyOp : fir_Op<"copy", []> {
+  let summary = "copy constant size memory";
+
+  let description = [{
+    Copy the memory from a source with compile time constant size to
+    a destination of the same type.
+
+    This is meant to be used for aggregate types where load and store
+    are not appropriate to make a copy because LLVM is not meant to
+    handle load and store of "big" aggregates.
----------------
jeanPerier wrote:

Yes, although there is nothing that would technically prevent it to be used for intrinsic types, it seems saner to prevent it. I added a predicate.

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


More information about the flang-commits mailing list