File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -7384,7 +7384,40 @@ class MappableExprsHandler {
7384
7384
// dimension.
7385
7385
uint64_t DimSize = 1;
7386
7386
7387
- bool IsNonContiguous = CombinedInfo.NonContigInfo.IsNonContiguous;
7387
+ // Detects non-contiguous updates due to strided accesses.
7388
+ // Sets the 'IsNonContiguous' flag so that the 'MapType' bits are set
7389
+ // correctly when generating information to be passed to the runtime. The
7390
+ // flag is set to true if any array section has a stride not equal to 1, or
7391
+ // if the stride is not a constant expression (conservatively assumed
7392
+ // non-contiguous).
7393
+ bool IsNonContiguous = false;
7394
+ for (const auto &Component : Components) {
7395
+ const auto *OASE =
7396
+ dyn_cast<ArraySectionExpr>(Component.getAssociatedExpression());
7397
+ if (OASE) {
7398
+ const Expr *StrideExpr = OASE->getStride();
7399
+ if (StrideExpr) {
7400
+ // Check if the stride is a constant integer expression
7401
+ if (StrideExpr->isIntegerConstantExpr(CGF.getContext())) {
7402
+ if (auto Constant =
7403
+ StrideExpr->getIntegerConstantExpr(CGF.getContext())) {
7404
+ int64_t StrideVal = Constant->getExtValue();
7405
+ if (StrideVal != 1) {
7406
+ // Set flag if stride is not 1 (i.e., non-contiguous update)
7407
+ IsNonContiguous = true;
7408
+ break;
7409
+ }
7410
+ }
7411
+ } else {
7412
+ // If stride is not a constant, conservatively treat as
7413
+ // non-contiguous
7414
+ IsNonContiguous = true;
7415
+ break;
7416
+ }
7417
+ }
7418
+ }
7419
+ }
7420
+
7388
7421
bool IsPrevMemberReference = false;
7389
7422
7390
7423
bool IsPartialMapped =
You can’t perform that action at this time.
0 commit comments