[clang] [llvm] [Clang][OpenMP] Non-contiguous strided update (PR #144635)
Amit Tiwari via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 23 00:41:11 PDT 2025
================
@@ -7384,7 +7384,40 @@ class MappableExprsHandler {
// dimension.
uint64_t DimSize = 1;
- bool IsNonContiguous = CombinedInfo.NonContigInfo.IsNonContiguous;
+ // Detects non-contiguous updates due to strided accesses.
+ // Sets the 'IsNonContiguous' flag so that the 'MapType' bits are set
+ // correctly when generating information to be passed to the runtime. The
+ // flag is set to true if any array section has a stride not equal to 1, or
+ // if the stride is not a constant expression (conservatively assumed
+ // non-contiguous).
+ bool IsNonContiguous = false;
+ for (const auto &Component : Components) {
+ const auto *OASE =
+ dyn_cast<ArraySectionExpr>(Component.getAssociatedExpression());
+ if (OASE) {
+ const Expr *StrideExpr = OASE->getStride();
+ if (StrideExpr) {
+ // Check if the stride is a constant integer expression
+ if (StrideExpr->isIntegerConstantExpr(CGF.getContext())) {
----------------
amitamd7 wrote:
Yes, because `stride` can be a variable/complex expression that is determined only at runtime, so conservatively treating it as non-contiguous.
https://github.com/llvm/llvm-project/pull/144635
More information about the cfe-commits
mailing list