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

Kajetan Puchalski via llvm-commits llvm-commits at lists.llvm.org
Mon May 19 14:22:45 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) {
----------------
mrkajetanp wrote:

That's quite a lot of code duplication, no? I tried to avoid that, hence the current implementation being what it is. But if you think that's not as important a concern then I can try to implement it that way of course.

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


More information about the llvm-commits mailing list