[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


================
@@ -437,6 +437,43 @@ class Descriptor {
 };
 static_assert(sizeof(Descriptor) == sizeof(ISO::CFI_cdesc_t));
 
+// Lightweight iterator-like API to simplify specialising Descriptor indexing
+// in cases where it can improve application performance. On account of the
+// purpose of this API being performance optimisation, it is up to the user to
+// do all the necessary checks to make sure the RANK1=true variant can be used
+// safely and that Advance() is not called more times than the number of
+// elements in the Descriptor allows for.
+template <bool RANK1 = false> class DescriptorIterator {
----------------
vzakhari wrote:

I think we'd better generalize this for any constant rank (not exceeding the max rank) and let the build compiler optimize all the different versions, e.g. I expect that the rank-1 case will be as simple as your current implementation.

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


More information about the llvm-commits mailing list