[llvm] [flang-rt] Optimise ShallowCopy and elemental copies in Assign (PR #140569)

Slava Zakharin via llvm-commits llvm-commits at lists.llvm.org
Mon May 19 15:24:16 PDT 2025


================
@@ -158,13 +196,25 @@ RT_API_ATTRS void ShallowCopy(const Descriptor &to, const Descriptor &from,
       std::memcpy(to.OffsetElement(), from.OffsetElement(),
           to.Elements() * to.ElementBytes());
     } else {
-      ShallowCopyDiscontiguousToContiguous(to, from);
+      if (to.rank() == 1 && from.rank() == 1) {
----------------
vzakhari wrote:

Most of the code should go into a template.  Yes, there will be multiple instantiations, but it is not a big deal.  Yes, it will affect the size of flang-rt, but I do not think the effect will be noticeable on top of all the matmul instances.

As I said, it looks okay to me as-is to start with.

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


More information about the llvm-commits mailing list