[clang] [llvm] [Clang][OpenMP] Non-contiguous strided update (PR #144635)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 23 07:22:33 PDT 2025
================
@@ -7378,7 +7378,35 @@ 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 = [&]() -> bool {
+ for (const auto &Component : Components) {
+ const auto *OASE =
+ dyn_cast<ArraySectionExpr>(Component.getAssociatedExpression());
+ if (!OASE) {
+ continue;
+ }
+ const Expr *StrideExpr = OASE->getStride();
+ if (!StrideExpr) {
+ continue;
+ }
+ const auto Constant =
+ StrideExpr->getIntegerConstantExpr(CGF.getContext());
+ if (!Constant) {
+ continue;
+ }
+ if (!Constant->isOne()) {
+ return true;
+ }
----------------
alexey-bataev wrote:
Drop extra braces
https://github.com/llvm/llvm-project/pull/144635
More information about the llvm-commits
mailing list