[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 14:04:55 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:

It should be okay to start with rank-1 recognition here, but it is probably better to call different versions from the compiler specialized for the particular rank.

In other words, we may have `ShallowCopy` versions for each trivial data type per each constant rank.

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


More information about the llvm-commits mailing list