[llvm] [flang-rt] Optimise ShallowCopy and use it in CopyInAssign (PR #140569)
Yusuke MINATO via llvm-commits
llvm-commits at lists.llvm.org
Wed May 21 21:54:05 PDT 2025
================
@@ -437,6 +437,64 @@ 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 specialised variants can be used
+// safely and that Advance() is not called more times than the number of
+// elements in the Descriptor allows for.
+// Default RANK=-1 supports aray descriptors of any rank up to maxRank.
+template <int RANK = -1> class DescriptorIterator {
+private:
+ const Descriptor &descriptor;
+ SubscriptValue subscripts[maxRank];
+ std::size_t elementOffset = 0;
----------------
yus3710-fj wrote:
```suggestion
std::size_t elementOffset{0};
```
https://github.com/llvm/llvm-project/pull/140569
More information about the llvm-commits
mailing list