[clang] [llvm] [Clang][OpenMP] Support expression semantics in target update fields with non-contiguous array sections (PR #176708)
Amit Tiwari via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 16 07:34:59 PST 2026
================
@@ -8034,11 +8034,27 @@ class MappableExprsHandler {
if (!StrideExpr)
return false;
+ assert(StrideExpr->getType()->isIntegerType() &&
+ "Stride expression must be of integer type");
+
+ // If the stride is a variable (not a constant), it's non-contiguous.
+ const Expr *S = StrideExpr->IgnoreParenImpCasts();
+ if (const auto *DRE = dyn_cast<DeclRefExpr>(S)) {
+ if (isa<VarDecl>(DRE->getDecl()) ||
+ isa<ParmVarDecl>(DRE->getDecl()))
+ return true;
+ }
+ if (isa<MemberExpr>(S) || isa<ArraySubscriptExpr>(S))
+ return true;
+
+ // If stride is not evaluatable as a constant, treat as
+ // non-contiguous.
const auto Constant =
StrideExpr->getIntegerConstantExpr(CGF.getContext());
if (!Constant)
return false;
----------------
amitamd7 wrote:
Yep, thanks for catching this one. Corrected.
https://github.com/llvm/llvm-project/pull/176708
More information about the cfe-commits
mailing list