[clang] Adding support for iterator in motion clauses. (PR #159112)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 19 22:47:06 PST 2025
https://github.com/ShashwathiNavada updated https://github.com/llvm/llvm-project/pull/159112
>From 7bec4d102da2e3c99a8a8d83167471637d94f897 Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Tue, 16 Sep 2025 10:23:50 -0500
Subject: [PATCH 01/14] Adding support for iterator in motion clauses
---
clang/docs/OpenMPSupport.rst | 2 +-
clang/include/clang/AST/OpenMPClause.h | 27 ++++++++-----
clang/include/clang/Basic/OpenMPKinds.def | 1 +
clang/include/clang/Sema/SemaOpenMP.h | 4 +-
clang/lib/AST/OpenMPClause.cpp | 26 +++++++++----
clang/lib/Parse/ParseOpenMP.cpp | 14 +++++++
clang/lib/Sema/SemaOpenMP.cpp | 38 ++++++++++++-------
clang/lib/Sema/TreeTransform.h | 36 ++++++++++++++----
clang/lib/Serialization/ASTReader.cpp | 4 ++
clang/lib/Serialization/ASTWriter.cpp | 4 ++
.../target_update_iterator_ast_print.cpp | 16 ++++++++
11 files changed, 130 insertions(+), 42 deletions(-)
create mode 100644 clang/test/OpenMP/target_update_iterator_ast_print.cpp
diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 0bc8590815220..a3e4272ceaf2f 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -266,7 +266,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | has_device_addr clause on target construct | :none:`unclaimed` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | iterators in map clause or motion clauses | :none:`unclaimed` | |
+| device | iterators in map clause or motion clauses | :good:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | indirect clause on declare target directive | :part:`In Progress` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index b2a6d4b9182b0..4e5a86482fbd4 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -7476,7 +7476,7 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
/// Motion-modifiers for the 'to' clause.
OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
- OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown};
+ OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown};
/// Location of motion-modifiers for the 'to' clause.
SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
@@ -7548,6 +7548,9 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
MotionModifiersLoc[I] = TLoc;
}
+ void setIteratorModifier(Expr *IteratorModifier) {
+ getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
+ }
/// Set colon location.
void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
@@ -7556,7 +7559,7 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
size_t numTrailingObjects(OverloadToken<Expr *>) const {
// There are varlist_size() of expressions, and varlist_size() of
// user-defined mappers.
- return 2 * varlist_size();
+ return 2 * varlist_size() + 1;
}
size_t numTrailingObjects(OverloadToken<ValueDecl *>) const {
return getUniqueDeclarationsNum();
@@ -7586,7 +7589,7 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
ArrayRef<Expr *> Vars,
ArrayRef<ValueDecl *> Declarations,
MappableExprComponentListsRef ComponentLists,
- ArrayRef<Expr *> UDMapperRefs,
+ ArrayRef<Expr *> UDMapperRefs,Expr *IteratorModifier,
ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
NestedNameSpecifierLoc UDMQualifierLoc,
@@ -7611,7 +7614,9 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
"Requested modifier exceeds the total number of modifiers.");
return MotionModifiers[Cnt];
}
-
+ Expr *getIteratorModifier() {
+ return getTrailingObjects<Expr *>()[2 * varlist_size()];
+ }
/// Fetches the motion-modifier location at 'Cnt' index of array of modifiers'
/// locations.
///
@@ -7677,7 +7682,7 @@ class OMPFromClause final
/// Motion-modifiers for the 'from' clause.
OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
- OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown};
+ OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown};
/// Location of motion-modifiers for the 'from' clause.
SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
@@ -7738,7 +7743,9 @@ class OMPFromClause final
"Unexpected index to store motion modifier, exceeds array size.");
MotionModifiers[I] = T;
}
-
+ void setIteratorModifier(Expr *IteratorModifier) {
+ getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
+ }
/// Set location for the motion-modifier.
///
/// \param I index for motion-modifier location.
@@ -7757,7 +7764,7 @@ class OMPFromClause final
size_t numTrailingObjects(OverloadToken<Expr *>) const {
// There are varlist_size() of expressions, and varlist_size() of
// user-defined mappers.
- return 2 * varlist_size();
+ return 2 * varlist_size() + 1;
}
size_t numTrailingObjects(OverloadToken<ValueDecl *>) const {
return getUniqueDeclarationsNum();
@@ -7787,7 +7794,7 @@ class OMPFromClause final
Create(const ASTContext &C, const OMPVarListLocTy &Locs,
ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
MappableExprComponentListsRef ComponentLists,
- ArrayRef<Expr *> UDMapperRefs,
+ ArrayRef<Expr *> UDMapperRefs, Expr *IteratorExpr,
ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId);
@@ -7811,7 +7818,9 @@ class OMPFromClause final
"Requested modifier exceeds the total number of modifiers.");
return MotionModifiers[Cnt];
}
-
+ Expr *getIteratorModifier() {
+ return getTrailingObjects<Expr *>()[2 * varlist_size()];
+ }
/// Fetches the motion-modifier location at 'Cnt' index of array of modifiers'
/// locations.
///
diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def
index 79c11b851c557..7944dc6916c94 100644
--- a/clang/include/clang/Basic/OpenMPKinds.def
+++ b/clang/include/clang/Basic/OpenMPKinds.def
@@ -194,6 +194,7 @@ OPENMP_MAP_MODIFIER_KIND(ompx_hold)
// Modifiers for 'to' or 'from' clause.
OPENMP_MOTION_MODIFIER_KIND(mapper)
+OPENMP_MOTION_MODIFIER_KIND(iterator)
OPENMP_MOTION_MODIFIER_KIND(present)
// Static attributes for 'dist_schedule' clause.
diff --git a/clang/include/clang/Sema/SemaOpenMP.h b/clang/include/clang/Sema/SemaOpenMP.h
index 23827051ed724..ecfbe3284a202 100644
--- a/clang/include/clang/Sema/SemaOpenMP.h
+++ b/clang/include/clang/Sema/SemaOpenMP.h
@@ -1323,7 +1323,7 @@ class SemaOpenMP : public SemaBase {
OMPClause *
ActOnOpenMPToClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
- CXXScopeSpec &MapperIdScopeSpec,
+ Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
ArrayRef<Expr *> UnresolvedMappers = {});
@@ -1331,7 +1331,7 @@ class SemaOpenMP : public SemaBase {
OMPClause *
ActOnOpenMPFromClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
- CXXScopeSpec &MapperIdScopeSpec,
+ Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
ArrayRef<Expr *> UnresolvedMappers = {});
diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp
index 69d33019c0952..de352df0f93f9 100644
--- a/clang/lib/AST/OpenMPClause.cpp
+++ b/clang/lib/AST/OpenMPClause.cpp
@@ -1218,7 +1218,7 @@ OMPToClause *OMPToClause::Create(
const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef<Expr *> Vars,
ArrayRef<ValueDecl *> Declarations,
MappableExprComponentListsRef ComponentLists, ArrayRef<Expr *> UDMapperRefs,
- ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
+ Expr *IteratorModifier, ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId) {
OMPMappableExprListSizeTy Sizes;
@@ -1240,7 +1240,7 @@ OMPToClause *OMPToClause::Create(
void *Mem = C.Allocate(
totalSizeToAlloc<Expr *, ValueDecl *, unsigned,
OMPClauseMappableExprCommon::MappableComponent>(
- 2 * Sizes.NumVars, Sizes.NumUniqueDeclarations,
+ 2 * Sizes.NumVars + 1, Sizes.NumUniqueDeclarations,
Sizes.NumUniqueDeclarations + Sizes.NumComponentLists,
Sizes.NumComponents));
@@ -1250,6 +1250,7 @@ OMPToClause *OMPToClause::Create(
Clause->setVarRefs(Vars);
Clause->setUDMapperRefs(UDMapperRefs);
Clause->setClauseInfo(Declarations, ComponentLists);
+ Clause->setIteratorModifier(IteratorModifier);
return Clause;
}
@@ -1258,17 +1259,19 @@ OMPToClause *OMPToClause::CreateEmpty(const ASTContext &C,
void *Mem = C.Allocate(
totalSizeToAlloc<Expr *, ValueDecl *, unsigned,
OMPClauseMappableExprCommon::MappableComponent>(
- 2 * Sizes.NumVars, Sizes.NumUniqueDeclarations,
+ 2 * Sizes.NumVars + 1, Sizes.NumUniqueDeclarations,
Sizes.NumUniqueDeclarations + Sizes.NumComponentLists,
Sizes.NumComponents));
- return new (Mem) OMPToClause(Sizes);
+ OMPToClause *Clause = new (Mem) OMPToClause(Sizes);
+ Clause->setIteratorModifier(nullptr);
+ return Clause;
}
OMPFromClause *OMPFromClause::Create(
const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef<Expr *> Vars,
ArrayRef<ValueDecl *> Declarations,
MappableExprComponentListsRef ComponentLists, ArrayRef<Expr *> UDMapperRefs,
- ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
+ Expr *IteratorModifier, ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId) {
OMPMappableExprListSizeTy Sizes;
@@ -1290,7 +1293,7 @@ OMPFromClause *OMPFromClause::Create(
void *Mem = C.Allocate(
totalSizeToAlloc<Expr *, ValueDecl *, unsigned,
OMPClauseMappableExprCommon::MappableComponent>(
- 2 * Sizes.NumVars, Sizes.NumUniqueDeclarations,
+ 2 * Sizes.NumVars + 1, Sizes.NumUniqueDeclarations,
Sizes.NumUniqueDeclarations + Sizes.NumComponentLists,
Sizes.NumComponents));
@@ -1301,6 +1304,7 @@ OMPFromClause *OMPFromClause::Create(
Clause->setVarRefs(Vars);
Clause->setUDMapperRefs(UDMapperRefs);
Clause->setClauseInfo(Declarations, ComponentLists);
+ Clause->setIteratorModifier(IteratorModifier);
return Clause;
}
@@ -1310,10 +1314,12 @@ OMPFromClause::CreateEmpty(const ASTContext &C,
void *Mem = C.Allocate(
totalSizeToAlloc<Expr *, ValueDecl *, unsigned,
OMPClauseMappableExprCommon::MappableComponent>(
- 2 * Sizes.NumVars, Sizes.NumUniqueDeclarations,
+ 2 * Sizes.NumVars + 1, Sizes.NumUniqueDeclarations,
Sizes.NumUniqueDeclarations + Sizes.NumComponentLists,
Sizes.NumComponents));
- return new (Mem) OMPFromClause(Sizes);
+ OMPFromClause *Clause = new (Mem) OMPFromClause(Sizes);
+ Clause->setIteratorModifier(nullptr);
+ return Clause;
}
void OMPUseDevicePtrClause::setPrivateCopies(ArrayRef<Expr *> VL) {
@@ -2564,12 +2570,16 @@ template <typename T> void OMPClausePrinter::VisitOMPMotionClause(T *Node) {
OS << '(';
for (unsigned I = 0; I < NumberOfOMPMotionModifiers; ++I) {
if (Node->getMotionModifier(I) != OMPC_MOTION_MODIFIER_unknown) {
+ if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator)
+ PrintIterator(OS, Node, Policy);
+ else {
OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(),
Node->getMotionModifier(I));
if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)
PrintMapper(OS, Node, Policy);
if (I < ModifierCount - 1)
OS << ", ";
+ }
}
}
OS << ':';
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 7dceb2d208352..75fd5a12ff3a1 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4699,6 +4699,19 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
break;
Data.MotionModifiers.push_back(Modifier);
Data.MotionModifiersLoc.push_back(Tok.getLocation());
+ if (PP.getSpelling(Tok) == "iterator" && getLangOpts().OpenMP >= 51) {
+ ColonProtectionRAIIObject ColonRAII(*this);
+ TentativeParsingAction TPA(*this);
+ ExprResult Tail;
+ HasIterator = true;
+ EnterScope(Scope::OpenMPDirectiveScope | Scope::DeclScope);
+ Tail = ParseOpenMPIteratorsExpr();
+ Tail = Actions.ActOnFinishFullExpr(Tail.get(), T.getOpenLocation(),
+ /*DiscardedValue=*/false);
+ if (Tail.isUsable()) {
+ Data.IteratorExpr = Tail.get();
+ }
+ } else {
ConsumeToken();
if (Modifier == OMPC_MOTION_MODIFIER_mapper) {
IsInvalidMapperModifier = parseMapperModifier(Data);
@@ -4712,6 +4725,7 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
// TODO: Is that intentional?
if (Tok.is(tok::comma))
ConsumeToken();
+ }
}
if (!Data.MotionModifiers.empty() && Tok.isNot(tok::colon)) {
if (!IsInvalidMapperModifier) {
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 66bdd6e72d827..f44e6be061c5d 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -17723,16 +17723,16 @@ OMPClause *SemaOpenMP::ActOnOpenMPVarListClause(OpenMPClauseKind Kind,
ExtraModifierLoc, ColonLoc, VarList, Locs);
break;
case OMPC_to:
- Res =
- ActOnOpenMPToClause(Data.MotionModifiers, Data.MotionModifiersLoc,
- Data.ReductionOrMapperIdScopeSpec,
- Data.ReductionOrMapperId, ColonLoc, VarList, Locs);
+ Res = ActOnOpenMPToClause(
+ Data.MotionModifiers, Data.MotionModifiersLoc, Data.IteratorExpr,
+ Data.ReductionOrMapperIdScopeSpec, Data.ReductionOrMapperId, ColonLoc,
+ VarList, Locs);
break;
case OMPC_from:
- Res = ActOnOpenMPFromClause(Data.MotionModifiers, Data.MotionModifiersLoc,
- Data.ReductionOrMapperIdScopeSpec,
- Data.ReductionOrMapperId, ColonLoc, VarList,
- Locs);
+ Res = ActOnOpenMPFromClause(
+ Data.MotionModifiers, Data.MotionModifiersLoc, Data.IteratorExpr,
+ Data.ReductionOrMapperIdScopeSpec, Data.ReductionOrMapperId, ColonLoc,
+ VarList, Locs);
break;
case OMPC_use_device_ptr:
Res = ActOnOpenMPUseDevicePtrClause(VarList, Locs);
@@ -23465,10 +23465,12 @@ void SemaOpenMP::ActOnOpenMPDeclareTargetInitializer(Decl *TargetDecl) {
OMPClause *SemaOpenMP::ActOnOpenMPToClause(
ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
+ Expr *IteratorExpr,
CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
const OMPVarListLocTy &Locs, ArrayRef<Expr *> UnresolvedMappers) {
OpenMPMotionModifierKind Modifiers[] = {OMPC_MOTION_MODIFIER_unknown,
+ OMPC_MOTION_MODIFIER_unknown,
OMPC_MOTION_MODIFIER_unknown};
SourceLocation ModifiersLoc[NumberOfOMPMotionModifiers];
@@ -23492,20 +23494,24 @@ OMPClause *SemaOpenMP::ActOnOpenMPToClause(
MapperIdScopeSpec, MapperId, UnresolvedMappers);
if (MVLI.ProcessedVarList.empty())
return nullptr;
-
+ if(IteratorExpr)
+ if (auto *DRE = dyn_cast<DeclRefExpr>(IteratorExpr))
+ if (auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
+ DSAStack->addIteratorVarDecl(VD);
return OMPToClause::Create(
getASTContext(), Locs, MVLI.ProcessedVarList, MVLI.VarBaseDeclarations,
- MVLI.VarComponents, MVLI.UDMapperList, Modifiers, ModifiersLoc,
+ MVLI.VarComponents, MVLI.UDMapperList,IteratorExpr, Modifiers, ModifiersLoc,
MapperIdScopeSpec.getWithLocInContext(getASTContext()), MapperId);
}
OMPClause *SemaOpenMP::ActOnOpenMPFromClause(
ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
- ArrayRef<SourceLocation> MotionModifiersLoc,
+ ArrayRef<SourceLocation> MotionModifiersLoc, Expr *IteratorExpr,
CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
const OMPVarListLocTy &Locs, ArrayRef<Expr *> UnresolvedMappers) {
OpenMPMotionModifierKind Modifiers[] = {OMPC_MOTION_MODIFIER_unknown,
+ OMPC_MOTION_MODIFIER_unknown,
OMPC_MOTION_MODIFIER_unknown};
SourceLocation ModifiersLoc[NumberOfOMPMotionModifiers];
@@ -23529,11 +23535,15 @@ OMPClause *SemaOpenMP::ActOnOpenMPFromClause(
MapperIdScopeSpec, MapperId, UnresolvedMappers);
if (MVLI.ProcessedVarList.empty())
return nullptr;
-
+ if (IteratorExpr)
+ if (auto *DRE = dyn_cast<DeclRefExpr>(IteratorExpr))
+ if (auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
+ DSAStack->addIteratorVarDecl(VD);
return OMPFromClause::Create(
getASTContext(), Locs, MVLI.ProcessedVarList, MVLI.VarBaseDeclarations,
- MVLI.VarComponents, MVLI.UDMapperList, Modifiers, ModifiersLoc,
- MapperIdScopeSpec.getWithLocInContext(getASTContext()), MapperId);
+ MVLI.VarComponents, MVLI.UDMapperList, IteratorExpr, Modifiers,
+ ModifiersLoc, MapperIdScopeSpec.getWithLocInContext(getASTContext()),
+ MapperId);
}
OMPClause *
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 242ffb09af006..636f54c212f71 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -2196,13 +2196,15 @@ class TreeTransform {
OMPClause *
RebuildOMPToClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
+ Expr *IteratorModifier,
CXXScopeSpec &MapperIdScopeSpec,
DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
ArrayRef<Expr *> UnresolvedMappers) {
return getSema().OpenMP().ActOnOpenMPToClause(
- MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
- ColonLoc, VarList, Locs, UnresolvedMappers);
+ MotionModifiers, MotionModifiersLoc, IteratorModifier,
+ MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
+ UnresolvedMappers);
}
/// Build a new OpenMP 'from' clause.
@@ -2212,13 +2214,15 @@ class TreeTransform {
OMPClause *
RebuildOMPFromClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
+ Expr *IteratorModifier,
CXXScopeSpec &MapperIdScopeSpec,
DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
ArrayRef<Expr *> UnresolvedMappers) {
return getSema().OpenMP().ActOnOpenMPFromClause(
- MotionModifiers, MotionModifiersLoc, MapperIdScopeSpec, MapperId,
- ColonLoc, VarList, Locs, UnresolvedMappers);
+ MotionModifiers, MotionModifiersLoc, IteratorModifier,
+ MapperIdScopeSpec, MapperId, ColonLoc, VarList, Locs,
+ UnresolvedMappers);
}
/// Build a new OpenMP 'use_device_ptr' clause.
@@ -11411,6 +11415,13 @@ template <typename Derived>
OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *C) {
OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
llvm::SmallVector<Expr *, 16> Vars;
+ Expr *IteratorModifier = C->getIteratorModifier();
+ if (IteratorModifier) {
+ ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
+ if (MapModRes.isInvalid())
+ return nullptr;
+ IteratorModifier = MapModRes.get();
+ }
CXXScopeSpec MapperIdScopeSpec;
DeclarationNameInfo MapperIdInfo;
llvm::SmallVector<Expr *, 16> UnresolvedMappers;
@@ -11418,14 +11429,22 @@ OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *C) {
*this, C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
return nullptr;
return getDerived().RebuildOMPToClause(
- C->getMotionModifiers(), C->getMotionModifiersLoc(), MapperIdScopeSpec,
- MapperIdInfo, C->getColonLoc(), Vars, Locs, UnresolvedMappers);
+ C->getMotionModifiers(), C->getMotionModifiersLoc(), IteratorModifier,
+ MapperIdScopeSpec, MapperIdInfo, C->getColonLoc(), Vars, Locs,
+ UnresolvedMappers);
}
template <typename Derived>
OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *C) {
OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
llvm::SmallVector<Expr *, 16> Vars;
+ Expr *IteratorModifier = C->getIteratorModifier();
+ if (IteratorModifier) {
+ ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
+ if (MapModRes.isInvalid())
+ return nullptr;
+ IteratorModifier = MapModRes.get();
+ }
CXXScopeSpec MapperIdScopeSpec;
DeclarationNameInfo MapperIdInfo;
llvm::SmallVector<Expr *, 16> UnresolvedMappers;
@@ -11433,8 +11452,9 @@ OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *C) {
*this, C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
return nullptr;
return getDerived().RebuildOMPFromClause(
- C->getMotionModifiers(), C->getMotionModifiersLoc(), MapperIdScopeSpec,
- MapperIdInfo, C->getColonLoc(), Vars, Locs, UnresolvedMappers);
+ C->getMotionModifiers(), C->getMotionModifiersLoc(), IteratorModifier,
+ MapperIdScopeSpec, MapperIdInfo, C->getColonLoc(), Vars, Locs,
+ UnresolvedMappers);
}
template <typename Derived>
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 9ee8a0fb0f060..736ca0e4382bc 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -12321,6 +12321,8 @@ void OMPClauseReader::VisitOMPToClause(OMPToClause *C) {
C->setMotionModifier(
I, static_cast<OpenMPMotionModifierKind>(Record.readInt()));
C->setMotionModifierLoc(I, Record.readSourceLocation());
+ if (C->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator)
+ C->setIteratorModifier(Record.readExpr());
}
C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
C->setMapperIdInfo(Record.readDeclarationNameInfo());
@@ -12377,6 +12379,8 @@ void OMPClauseReader::VisitOMPFromClause(OMPFromClause *C) {
C->setMotionModifier(
I, static_cast<OpenMPMotionModifierKind>(Record.readInt()));
C->setMotionModifierLoc(I, Record.readSourceLocation());
+ if (C->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator)
+ C->setIteratorModifier(Record.readExpr());
}
C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
C->setMapperIdInfo(Record.readDeclarationNameInfo());
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 2aa77934c08d1..205408ca6e9d2 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -8372,6 +8372,8 @@ void OMPClauseWriter::VisitOMPToClause(OMPToClause *C) {
for (unsigned I = 0; I < NumberOfOMPMotionModifiers; ++I) {
Record.push_back(C->getMotionModifier(I));
Record.AddSourceLocation(C->getMotionModifierLoc(I));
+ if (C->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator)
+ Record.AddStmt(C->getIteratorModifier());
}
Record.AddNestedNameSpecifierLoc(C->getMapperQualifierLoc());
Record.AddDeclarationNameInfo(C->getMapperIdInfo());
@@ -8402,6 +8404,8 @@ void OMPClauseWriter::VisitOMPFromClause(OMPFromClause *C) {
for (unsigned I = 0; I < NumberOfOMPMotionModifiers; ++I) {
Record.push_back(C->getMotionModifier(I));
Record.AddSourceLocation(C->getMotionModifierLoc(I));
+ if (C->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator)
+ Record.AddStmt(C->getIteratorModifier());
}
Record.AddNestedNameSpecifierLoc(C->getMapperQualifierLoc());
Record.AddDeclarationNameInfo(C->getMapperIdInfo());
diff --git a/clang/test/OpenMP/target_update_iterator_ast_print.cpp b/clang/test/OpenMP/target_update_iterator_ast_print.cpp
new file mode 100644
index 0000000000000..322f565c9c732
--- /dev/null
+++ b/clang/test/OpenMP/target_update_iterator_ast_print.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s | FileCheck %s
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+
+void test() {
+ int a[10];
+ #pragma omp target update to(iterator(int it = 0:10): a[it])
+ // CHECK: int a[10];
+ // CHECK: #pragma omp target update to(iterator(int it = 0:10): a[it])
+ #pragma omp target update from(iterator(int it = 0:10): a[it])
+ // CHECK: #pragma omp target update from(iterator(int it = 0:10): a[it])
+}
+
+#endif
>From d7aa585f082bbe531461f968a73c2cf42eb8584e Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Tue, 16 Sep 2025 10:39:52 -0500
Subject: [PATCH 02/14] Formatting
---
clang/include/clang/AST/OpenMPClause.h | 23 ++++++++++++-----------
clang/lib/AST/OpenMPClause.cpp | 12 ++++++------
clang/lib/Parse/ParseOpenMP.cpp | 24 ++++++++++++------------
clang/lib/Sema/SemaOpenMP.cpp | 18 +++++++++---------
clang/lib/Sema/TreeTransform.h | 8 +++-----
5 files changed, 42 insertions(+), 43 deletions(-)
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index 4e5a86482fbd4..9681e35078064 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -7476,7 +7476,8 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
/// Motion-modifiers for the 'to' clause.
OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
- OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown};
+ OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown,
+ OMPC_MOTION_MODIFIER_unknown};
/// Location of motion-modifiers for the 'to' clause.
SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
@@ -7585,15 +7586,14 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
/// \param UDMQualifierLoc C++ nested name specifier for the associated
/// user-defined mapper.
/// \param MapperId The identifier of associated user-defined mapper.
- static OMPToClause *Create(const ASTContext &C, const OMPVarListLocTy &Locs,
- ArrayRef<Expr *> Vars,
- ArrayRef<ValueDecl *> Declarations,
- MappableExprComponentListsRef ComponentLists,
- ArrayRef<Expr *> UDMapperRefs,Expr *IteratorModifier,
- ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
- ArrayRef<SourceLocation> MotionModifiersLoc,
- NestedNameSpecifierLoc UDMQualifierLoc,
- DeclarationNameInfo MapperId);
+ static OMPToClause *
+ Create(const ASTContext &C, const OMPVarListLocTy &Locs,
+ ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
+ MappableExprComponentListsRef ComponentLists,
+ ArrayRef<Expr *> UDMapperRefs, Expr *IteratorModifier,
+ ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
+ ArrayRef<SourceLocation> MotionModifiersLoc,
+ NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId);
/// Creates an empty clause with the place for \a NumVars variables.
///
@@ -7682,7 +7682,8 @@ class OMPFromClause final
/// Motion-modifiers for the 'from' clause.
OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
- OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown};
+ OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown,
+ OMPC_MOTION_MODIFIER_unknown};
/// Location of motion-modifiers for the 'from' clause.
SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp
index de352df0f93f9..8146c1fa4d8f4 100644
--- a/clang/lib/AST/OpenMPClause.cpp
+++ b/clang/lib/AST/OpenMPClause.cpp
@@ -2573,12 +2573,12 @@ template <typename T> void OMPClausePrinter::VisitOMPMotionClause(T *Node) {
if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator)
PrintIterator(OS, Node, Policy);
else {
- OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(),
- Node->getMotionModifier(I));
- if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)
- PrintMapper(OS, Node, Policy);
- if (I < ModifierCount - 1)
- OS << ", ";
+ OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(),
+ Node->getMotionModifier(I));
+ if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)
+ PrintMapper(OS, Node, Policy);
+ if (I < ModifierCount - 1)
+ OS << ", ";
}
}
}
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 75fd5a12ff3a1..48296c50da5a7 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4712,19 +4712,19 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
Data.IteratorExpr = Tail.get();
}
} else {
- ConsumeToken();
- if (Modifier == OMPC_MOTION_MODIFIER_mapper) {
- IsInvalidMapperModifier = parseMapperModifier(Data);
- if (IsInvalidMapperModifier)
- break;
- }
- // OpenMP < 5.1 doesn't permit a ',' or additional modifiers.
- if (getLangOpts().OpenMP < 51)
- break;
- // OpenMP 5.1 accepts an optional ',' even if the next character is ':'.
- // TODO: Is that intentional?
- if (Tok.is(tok::comma))
ConsumeToken();
+ if (Modifier == OMPC_MOTION_MODIFIER_mapper) {
+ IsInvalidMapperModifier = parseMapperModifier(Data);
+ if (IsInvalidMapperModifier)
+ break;
+ }
+ // OpenMP < 5.1 doesn't permit a ',' or additional modifiers.
+ if (getLangOpts().OpenMP < 51)
+ break;
+ // OpenMP 5.1 accepts an optional ',' even if the next character is ':'.
+ // TODO: Is that intentional?
+ if (Tok.is(tok::comma))
+ ConsumeToken();
}
}
if (!Data.MotionModifiers.empty() && Tok.isNot(tok::colon)) {
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index f44e6be061c5d..2e37c85a9abab 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -23464,8 +23464,7 @@ void SemaOpenMP::ActOnOpenMPDeclareTargetInitializer(Decl *TargetDecl) {
OMPClause *SemaOpenMP::ActOnOpenMPToClause(
ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
- ArrayRef<SourceLocation> MotionModifiersLoc,
- Expr *IteratorExpr,
+ ArrayRef<SourceLocation> MotionModifiersLoc, Expr *IteratorExpr,
CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
const OMPVarListLocTy &Locs, ArrayRef<Expr *> UnresolvedMappers) {
@@ -23494,14 +23493,15 @@ OMPClause *SemaOpenMP::ActOnOpenMPToClause(
MapperIdScopeSpec, MapperId, UnresolvedMappers);
if (MVLI.ProcessedVarList.empty())
return nullptr;
- if(IteratorExpr)
- if (auto *DRE = dyn_cast<DeclRefExpr>(IteratorExpr))
- if (auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
+ if (IteratorExpr)
+ if (auto *DRE = dyn_cast<DeclRefExpr>(IteratorExpr))
+ if (auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
DSAStack->addIteratorVarDecl(VD);
return OMPToClause::Create(
getASTContext(), Locs, MVLI.ProcessedVarList, MVLI.VarBaseDeclarations,
- MVLI.VarComponents, MVLI.UDMapperList,IteratorExpr, Modifiers, ModifiersLoc,
- MapperIdScopeSpec.getWithLocInContext(getASTContext()), MapperId);
+ MVLI.VarComponents, MVLI.UDMapperList, IteratorExpr, Modifiers,
+ ModifiersLoc, MapperIdScopeSpec.getWithLocInContext(getASTContext()),
+ MapperId);
}
OMPClause *SemaOpenMP::ActOnOpenMPFromClause(
@@ -23536,8 +23536,8 @@ OMPClause *SemaOpenMP::ActOnOpenMPFromClause(
if (MVLI.ProcessedVarList.empty())
return nullptr;
if (IteratorExpr)
- if (auto *DRE = dyn_cast<DeclRefExpr>(IteratorExpr))
- if (auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
+ if (auto *DRE = dyn_cast<DeclRefExpr>(IteratorExpr))
+ if (auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
DSAStack->addIteratorVarDecl(VD);
return OMPFromClause::Create(
getASTContext(), Locs, MVLI.ProcessedVarList, MVLI.VarBaseDeclarations,
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 636f54c212f71..63da489a52164 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -2196,8 +2196,7 @@ class TreeTransform {
OMPClause *
RebuildOMPToClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
- Expr *IteratorModifier,
- CXXScopeSpec &MapperIdScopeSpec,
+ Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
ArrayRef<Expr *> UnresolvedMappers) {
@@ -2214,8 +2213,7 @@ class TreeTransform {
OMPClause *
RebuildOMPFromClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
ArrayRef<SourceLocation> MotionModifiersLoc,
- Expr *IteratorModifier,
- CXXScopeSpec &MapperIdScopeSpec,
+ Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
ArrayRef<Expr *> UnresolvedMappers) {
@@ -11438,7 +11436,7 @@ template <typename Derived>
OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *C) {
OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
llvm::SmallVector<Expr *, 16> Vars;
- Expr *IteratorModifier = C->getIteratorModifier();
+ Expr *IteratorModifier = C->getIteratorModifier();
if (IteratorModifier) {
ExprResult MapModRes = getDerived().TransformExpr(IteratorModifier);
if (MapModRes.isInvalid())
>From 98eebb6a44b72b15a19ee2078313469ee895ac2a Mon Sep 17 00:00:00 2001
From: ShashwathiNavada <shashwathinavada at gmail.com>
Date: Wed, 17 Sep 2025 11:17:01 +0530
Subject: [PATCH 03/14] Update ParseOpenMP.cpp
---
clang/lib/Parse/ParseOpenMP.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 48296c50da5a7..790eb23b48b2c 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4710,6 +4710,10 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
/*DiscardedValue=*/false);
if (Tail.isUsable()) {
Data.IteratorExpr = Tail.get();
+ TPA.Commit();
+ }
+ else
+ TPA.revert();
}
} else {
ConsumeToken();
>From 2ce56c225032db8275627584b08091e7af50e8f0 Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Wed, 17 Sep 2025 01:35:20 -0500
Subject: [PATCH 04/14] Fixed the error
---
clang/lib/Parse/ParseOpenMP.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 790eb23b48b2c..3b1b16ba39ccf 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4711,10 +4711,8 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
if (Tail.isUsable()) {
Data.IteratorExpr = Tail.get();
TPA.Commit();
- }
- else
- TPA.revert();
- }
+ } else
+ TPA.Revert();
} else {
ConsumeToken();
if (Modifier == OMPC_MOTION_MODIFIER_mapper) {
>From f32b8c81bb7f44cb29ede02b871ecd55f65deee7 Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Tue, 7 Oct 2025 02:47:07 -0500
Subject: [PATCH 05/14] modifications done
---
clang/include/clang/AST/OpenMPClause.h | 4 +-
clang/lib/AST/OpenMPClause.cpp | 4 +-
clang/test/OpenMP/target_update_codegen.cpp | 55 +++++++++++++++++++++
3 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index 9681e35078064..4fbc44d33caba 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -7614,7 +7614,7 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
"Requested modifier exceeds the total number of modifiers.");
return MotionModifiers[Cnt];
}
- Expr *getIteratorModifier() {
+ Expr *getIteratorModifier() const {
return getTrailingObjects<Expr *>()[2 * varlist_size()];
}
/// Fetches the motion-modifier location at 'Cnt' index of array of modifiers'
@@ -7819,7 +7819,7 @@ class OMPFromClause final
"Requested modifier exceeds the total number of modifiers.");
return MotionModifiers[Cnt];
}
- Expr *getIteratorModifier() {
+ Expr *getIteratorModifier() const {
return getTrailingObjects<Expr *>()[2 * varlist_size()];
}
/// Fetches the motion-modifier location at 'Cnt' index of array of modifiers'
diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp
index 8146c1fa4d8f4..e9127c5052bf1 100644
--- a/clang/lib/AST/OpenMPClause.cpp
+++ b/clang/lib/AST/OpenMPClause.cpp
@@ -2570,9 +2570,9 @@ template <typename T> void OMPClausePrinter::VisitOMPMotionClause(T *Node) {
OS << '(';
for (unsigned I = 0; I < NumberOfOMPMotionModifiers; ++I) {
if (Node->getMotionModifier(I) != OMPC_MOTION_MODIFIER_unknown) {
- if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator)
+ if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator) {
PrintIterator(OS, Node, Policy);
- else {
+ } else {
OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(),
Node->getMotionModifier(I));
if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)
diff --git a/clang/test/OpenMP/target_update_codegen.cpp b/clang/test/OpenMP/target_update_codegen.cpp
index c8211f475c7fc..2221c78ea197b 100644
--- a/clang/test/OpenMP/target_update_codegen.cpp
+++ b/clang/test/OpenMP/target_update_codegen.cpp
@@ -1560,5 +1560,60 @@ void foo(int arg) {
{ ++arg; }
}
+#endif
+// RUN: %clang_cc1 -DCK26 -verify -Wno-vla -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
+// RUN: %clang_cc1 -DCK26 -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
+// RUN: %clang_cc1 -DCK26 -fopenmp-version=51 -verify -Wno-vla -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
+// RUN: %clang_cc1 -DCK26 -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
+
+// RUN: %clang_cc1 -DCK26 -verify -Wno-vla -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY19 %s
+// RUN: %clang_cc1 -DCK26 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY19 %s
+// RUN: %clang_cc1 -DCK26 -verify -Wno-vla -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY19 %s
+// RUN: %clang_cc1 -DCK26 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY19 %s
+// SIMD-ONLY19-NOT: {{__kmpc|__tgt}}
+#ifdef CK26
+// CK26: [[IDENT_T:%.+]] = type { i32, i32, i32, i32, ptr }
+// CK26: @[[ITER:[a-zA-Z0-9_]+]] = internal global i32 0, align 4
+void foo(){
+int a[10];
+#pragma omp target update to(iterator(int it = 0:10) : a[it])
+// CHECK: define dso_local void @_Z4testv()
+// CHECK-NEXT: %[[A1:.*]] = alloca \[10 x i32\], align 16
+// CHECK-NEXT: %[[A2:.*]] = alloca \[1 x ptr\], align 8
+// CHECK-NEXT: %[[A3:.*]] = alloca \[1 x ptr\], align 8
+// CHECK-NEXT: %[[A4:.*]] = alloca \[1 x ptr\], align 8
+// CHECK-NEXT: %[[A5:.*]] = alloca \[1 x ptr\], align 8
+// CHECK-NEXT: %[[A6:.*]] = alloca \[1 x ptr\], align 8
+// CHECK-NEXT: %[[A7:.*]] = alloca \[1 x ptr\], align 8
+// CHECK: %[[LOAD1:.*]] = load i32, ptr @_ZZ4testvE16iteratorvariable, align 4
+// CHECK: %[[SEXT1:.*]] = sext i32 %[[LOAD1]] to i64
+// CHECK: %[[GEP1:.*]] = getelementptr inbounds \[10 x i32\], ptr %[[A1]], i64 0, i64 %[[SEXT1]]
+// CHECK: %[[GEP2:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A2]], i32 0, i32 0
+// CHECK: store ptr %[[A1]], ptr %[[GEP2]], align 8
+// CHECK: %[[GEP3:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A3]], i32 0, i32 0
+// CHECK: store ptr %[[GEP1]], ptr %[[GEP3]], align 8
+// CHECK: %[[GEP4:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A4]], i64 0, i64 0
+// CHECK: store ptr null, ptr %[[GEP4]], align 8
+// CHECK: %[[GEP5:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A2]], i32 0, i32 0
+// CHECK: %[[GEP6:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A3]], i32 0, i32 0
+// CHECK: call void @__tgt_target_data_update_mapper(ptr @2, i64 -1, i32 1, ptr %[[GEP5]], ptr %[[GEP6]], ptr @.offload_sizes, ptr @.offload_maptypes, ptr @.offload_mapnames, ptr null)
+// CHECK: %[[LOAD2:.*]] = load i32, ptr @[[ITER]], align 4
+// CHECK: %[[SEXT2:.*]] = sext i32 %[[LOAD2]] to i64
+// CHECK: %[[GEP7:.*]] = getelementptr inbounds \[10 x i32\], ptr %[[A1]], i64 0, i64 %[[SEXT2]]
+// CHECK: %[[GEP8:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A5]], i32 0, i32 0
+// CHECK: store ptr %[[A1]], ptr %[[GEP8]], align 8
+// CHECK: %[[GEP9:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A6]], i32 0, i32 0
+// CHECK: store ptr %[[GEP7]], ptr %[[GEP9]], align 8
+// CHECK: %[[GEP10:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A7]], i64 0, i64 0
+// CHECK: store ptr null, ptr %[[GEP10]], align 8
+// CHECK: %[[GEP11:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A5]], i32 0, i32 0
+// CHECK: %[[GEP12:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A6]], i32 0, i32 0
+// CHECK: call void @__tgt_target_data_update_mapper(ptr @4, i64 -1, i32 1, ptr %[[GEP11]], ptr %[[GEP12]], ptr @.offload_sizes.1, ptr @.offload_maptypes.2, ptr @.offload_mapnames.3, ptr null)
+// CHECK: ret void
+}
#endif
#endif
>From b0cc40d7b63dc01e5e09bacfd0cb7440b7a1c7a1 Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Tue, 7 Oct 2025 04:08:41 -0500
Subject: [PATCH 06/14] updated
---
clang/test/OpenMP/target_update_codegen.cpp | 35 ++-------------------
1 file changed, 2 insertions(+), 33 deletions(-)
diff --git a/clang/test/OpenMP/target_update_codegen.cpp b/clang/test/OpenMP/target_update_codegen.cpp
index 2221c78ea197b..c39a77a0c4935 100644
--- a/clang/test/OpenMP/target_update_codegen.cpp
+++ b/clang/test/OpenMP/target_update_codegen.cpp
@@ -1581,39 +1581,8 @@ void foo(int arg) {
void foo(){
int a[10];
#pragma omp target update to(iterator(int it = 0:10) : a[it])
-// CHECK: define dso_local void @_Z4testv()
-// CHECK-NEXT: %[[A1:.*]] = alloca \[10 x i32\], align 16
-// CHECK-NEXT: %[[A2:.*]] = alloca \[1 x ptr\], align 8
-// CHECK-NEXT: %[[A3:.*]] = alloca \[1 x ptr\], align 8
-// CHECK-NEXT: %[[A4:.*]] = alloca \[1 x ptr\], align 8
-// CHECK-NEXT: %[[A5:.*]] = alloca \[1 x ptr\], align 8
-// CHECK-NEXT: %[[A6:.*]] = alloca \[1 x ptr\], align 8
-// CHECK-NEXT: %[[A7:.*]] = alloca \[1 x ptr\], align 8
-// CHECK: %[[LOAD1:.*]] = load i32, ptr @_ZZ4testvE16iteratorvariable, align 4
-// CHECK: %[[SEXT1:.*]] = sext i32 %[[LOAD1]] to i64
-// CHECK: %[[GEP1:.*]] = getelementptr inbounds \[10 x i32\], ptr %[[A1]], i64 0, i64 %[[SEXT1]]
-// CHECK: %[[GEP2:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A2]], i32 0, i32 0
-// CHECK: store ptr %[[A1]], ptr %[[GEP2]], align 8
-// CHECK: %[[GEP3:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A3]], i32 0, i32 0
-// CHECK: store ptr %[[GEP1]], ptr %[[GEP3]], align 8
-// CHECK: %[[GEP4:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A4]], i64 0, i64 0
-// CHECK: store ptr null, ptr %[[GEP4]], align 8
-// CHECK: %[[GEP5:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A2]], i32 0, i32 0
-// CHECK: %[[GEP6:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A3]], i32 0, i32 0
-// CHECK: call void @__tgt_target_data_update_mapper(ptr @2, i64 -1, i32 1, ptr %[[GEP5]], ptr %[[GEP6]], ptr @.offload_sizes, ptr @.offload_maptypes, ptr @.offload_mapnames, ptr null)
-// CHECK: %[[LOAD2:.*]] = load i32, ptr @[[ITER]], align 4
-// CHECK: %[[SEXT2:.*]] = sext i32 %[[LOAD2]] to i64
-// CHECK: %[[GEP7:.*]] = getelementptr inbounds \[10 x i32\], ptr %[[A1]], i64 0, i64 %[[SEXT2]]
-// CHECK: %[[GEP8:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A5]], i32 0, i32 0
-// CHECK: store ptr %[[A1]], ptr %[[GEP8]], align 8
-// CHECK: %[[GEP9:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A6]], i32 0, i32 0
-// CHECK: store ptr %[[GEP7]], ptr %[[GEP9]], align 8
-// CHECK: %[[GEP10:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A7]], i64 0, i64 0
-// CHECK: store ptr null, ptr %[[GEP10]], align 8
-// CHECK: %[[GEP11:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A5]], i32 0, i32 0
-// CHECK: %[[GEP12:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A6]], i32 0, i32 0
-// CHECK: call void @__tgt_target_data_update_mapper(ptr @4, i64 -1, i32 1, ptr %[[GEP11]], ptr %[[GEP12]], ptr @.offload_sizes.1, ptr @.offload_maptypes.2, ptr @.offload_mapnames.3, ptr null)
-// CHECK: ret void
+// CK26-LABEL: define {{.+}}foo
+// CK26: %[[LOAD2:.*]] = load i32, ptr @[[ITER]], align 4
}
#endif
#endif
>From 00426dbe54e3073de9201e0cc02edab4c4a2eaea Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Wed, 12 Nov 2025 08:46:25 -0600
Subject: [PATCH 07/14] Codegen implementation
---
clang/lib/CodeGen/CGOpenMPRuntime.cpp | 26 +++++++++++++++++++++
clang/test/OpenMP/target_update_codegen.cpp | 16 +++++++++----
2 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index fa946921d468b..626b81c9b6a35 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -8632,6 +8632,19 @@ class MappableExprsHandler {
if (llvm::is_contained(C->getMotionModifiers(),
OMPC_MOTION_MODIFIER_present))
Kind = Present;
+ if (llvm::is_contained(C->getMotionModifiers(), OMPC_MOTION_MODIFIER_iterator)) {
+ if (auto *IteratorExpr =
+ dyn_cast<OMPIteratorExpr>(C->getIteratorModifier()->IgnoreParenImpCasts())) {
+ const auto *VD = llvm::dyn_cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
+ CGF.EmitVarDecl(*VD);
+
+ OMPIteratorGeneratorScope IteratorScope(
+ CGF,
+ cast_or_null<OMPIteratorExpr>(
+ IteratorExpr ? IteratorExpr->IgnoreParenImpCasts() : nullptr));
+ }
+ }
+
const auto *EI = C->getVarRefs().begin();
for (const auto L : C->component_lists()) {
InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_to, {},
@@ -8648,6 +8661,19 @@ class MappableExprsHandler {
if (llvm::is_contained(C->getMotionModifiers(),
OMPC_MOTION_MODIFIER_present))
Kind = Present;
+ if (llvm::is_contained(C->getMotionModifiers(), OMPC_MOTION_MODIFIER_iterator)) {
+ if (auto *IteratorExpr =
+ dyn_cast<OMPIteratorExpr>(C->getIteratorModifier()->IgnoreParenImpCasts())) {
+ const auto *VD = llvm::dyn_cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
+ CGF.EmitVarDecl(*VD);
+
+ OMPIteratorGeneratorScope IteratorScope(
+ CGF,
+ cast_or_null<OMPIteratorExpr>(
+ IteratorExpr ? IteratorExpr->IgnoreParenImpCasts() : nullptr));
+ }
+ }
+
const auto *EI = C->getVarRefs().begin();
for (const auto L : C->component_lists()) {
InfoGen(std::get<0>(L), Kind, std::get<1>(L), OMPC_MAP_from, {},
diff --git a/clang/test/OpenMP/target_update_codegen.cpp b/clang/test/OpenMP/target_update_codegen.cpp
index c39a77a0c4935..6c754c1c953ea 100644
--- a/clang/test/OpenMP/target_update_codegen.cpp
+++ b/clang/test/OpenMP/target_update_codegen.cpp
@@ -1576,13 +1576,21 @@ void foo(int arg) {
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY19 %s
// SIMD-ONLY19-NOT: {{__kmpc|__tgt}}
#ifdef CK26
-// CK26: [[IDENT_T:%.+]] = type { i32, i32, i32, i32, ptr }
-// CK26: @[[ITER:[a-zA-Z0-9_]+]] = internal global i32 0, align 4
-void foo(){
+void foo() {
int a[10];
#pragma omp target update to(iterator(int it = 0:10) : a[it])
// CK26-LABEL: define {{.+}}foo
-// CK26: %[[LOAD2:.*]] = load i32, ptr @[[ITER]], align 4
+// CK26: %[[ITER:[a-zA-Z0-9_]+]] = alloca i32, align 4
+// CK26: %[[LOAD2:.*]] = load i32, ptr %[[ITER]], align 4
}
+
+void foo1() {
+int a[10];
+#pragma omp target update from(iterator(int it = 0:10) : a[it])
+// CK26-LABEL: define {{.+}}foo1
+// CK26: %[[ITER:[a-zA-Z0-9_]+]] = alloca i32, align 4
+// CK26: %[[LOAD2:.*]] = load i32, ptr %[[ITER]], align 4
+}
+
#endif
#endif
>From 37ab2490769dc5c4b8d3cac475e2ad7aceccce6b Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Fri, 14 Nov 2025 00:39:19 -0600
Subject: [PATCH 08/14] Format
---
clang/lib/CodeGen/CGOpenMPRuntime.cpp | 32 +++++++++++++++------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 65b331906ed0e..5f050f31b6993 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -8633,16 +8633,18 @@ class MappableExprsHandler {
if (llvm::is_contained(C->getMotionModifiers(),
OMPC_MOTION_MODIFIER_present))
Kind = Present;
- if (llvm::is_contained(C->getMotionModifiers(), OMPC_MOTION_MODIFIER_iterator)) {
- if (auto *IteratorExpr =
- dyn_cast<OMPIteratorExpr>(C->getIteratorModifier()->IgnoreParenImpCasts())) {
- const auto *VD = llvm::dyn_cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
+ if (llvm::is_contained(C->getMotionModifiers(),
+ OMPC_MOTION_MODIFIER_iterator)) {
+ if (auto *IteratorExpr = dyn_cast<OMPIteratorExpr>(
+ C->getIteratorModifier()->IgnoreParenImpCasts())) {
+ const auto *VD =
+ llvm::dyn_cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
CGF.EmitVarDecl(*VD);
OMPIteratorGeneratorScope IteratorScope(
- CGF,
- cast_or_null<OMPIteratorExpr>(
- IteratorExpr ? IteratorExpr->IgnoreParenImpCasts() : nullptr));
+ CGF, cast_or_null<OMPIteratorExpr>(
+ IteratorExpr ? IteratorExpr->IgnoreParenImpCasts()
+ : nullptr));
}
}
@@ -8662,16 +8664,18 @@ class MappableExprsHandler {
if (llvm::is_contained(C->getMotionModifiers(),
OMPC_MOTION_MODIFIER_present))
Kind = Present;
- if (llvm::is_contained(C->getMotionModifiers(), OMPC_MOTION_MODIFIER_iterator)) {
- if (auto *IteratorExpr =
- dyn_cast<OMPIteratorExpr>(C->getIteratorModifier()->IgnoreParenImpCasts())) {
- const auto *VD = llvm::dyn_cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
+ if (llvm::is_contained(C->getMotionModifiers(),
+ OMPC_MOTION_MODIFIER_iterator)) {
+ if (auto *IteratorExpr = dyn_cast<OMPIteratorExpr>(
+ C->getIteratorModifier()->IgnoreParenImpCasts())) {
+ const auto *VD =
+ llvm::dyn_cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
CGF.EmitVarDecl(*VD);
OMPIteratorGeneratorScope IteratorScope(
- CGF,
- cast_or_null<OMPIteratorExpr>(
- IteratorExpr ? IteratorExpr->IgnoreParenImpCasts() : nullptr));
+ CGF, cast_or_null<OMPIteratorExpr>(
+ IteratorExpr ? IteratorExpr->IgnoreParenImpCasts()
+ : nullptr));
}
}
>From 3c01455187a1da3d295b8460157143d9503891b9 Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Fri, 14 Nov 2025 06:13:51 -0600
Subject: [PATCH 09/14] Minor change
---
clang/lib/Parse/ParseOpenMP.cpp | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index aafd89b690722..0b3d48a66f9b2 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4926,19 +4926,14 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
Data.MotionModifiers.push_back(Modifier);
Data.MotionModifiersLoc.push_back(Tok.getLocation());
if (PP.getSpelling(Tok) == "iterator" && getLangOpts().OpenMP >= 51) {
- ColonProtectionRAIIObject ColonRAII(*this);
- TentativeParsingAction TPA(*this);
ExprResult Tail;
- HasIterator = true;
EnterScope(Scope::OpenMPDirectiveScope | Scope::DeclScope);
Tail = ParseOpenMPIteratorsExpr();
Tail = Actions.ActOnFinishFullExpr(Tail.get(), T.getOpenLocation(),
/*DiscardedValue=*/false);
if (Tail.isUsable()) {
Data.IteratorExpr = Tail.get();
- TPA.Commit();
- } else
- TPA.Revert();
+ }
} else {
ConsumeToken();
if (Modifier == OMPC_MOTION_MODIFIER_mapper) {
>From 75078b394780f398a57b2b647195773618968f38 Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Thu, 20 Nov 2025 00:18:11 -0600
Subject: [PATCH 10/14] Added suggested changes
---
clang/docs/OpenMPSupport.rst | 647 ------------------
clang/lib/CodeGen/CGOpenMPRuntime.cpp | 14 +-
clang/lib/Parse/ParseOpenMP.cpp | 4 +-
.../target_update_iterator_serialization.cpp | 35 +
4 files changed, 38 insertions(+), 662 deletions(-)
create mode 100644 clang/test/OpenMP/target_update_iterator_serialization.cpp
diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 4fcfb14af4b8e..68c614646572b 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -188,653 +188,6 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | support non-contiguous array sections for target update | :good:`done` | https://github.com/llvm/llvm-project/pull/144635 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | pointer attachment | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| atomic | hints for the atomic construct | :good:`done` | D51233 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| base language | C11 support | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| base language | C++11/14/17 support | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| base language | lambda support | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | array shaping | :good:`done` | D74144 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | library shutdown (omp_pause_resource[_all]) | :good:`done` | D55078 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | metadirectives | :part:`mostly done` | D91944, https://github.com/llvm/llvm-project/pull/128640 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | conditional modifier for lastprivate clause | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | iterator and multidependences | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | depobj directive and depobj dependency kind | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | user-defined function variants | :good:`done`. | D67294, D64095, D71847, D71830, D109635 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | pointer/reference to pointer based array reductions | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | prevent new type definitions in clauses | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| memory model | memory model update (seq_cst, acq_rel, release, acquire,...) | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-
-
-.. _OpenMP 51 implementation details:
-
-OpenMP 5.1 Implementation Details
-
-The following table provides a quick overview over various OpenMP 5.1 features
-and their implementation status.
-Please post on the
-`Discourse forums (Runtimes - OpenMP category)`_ for more
-information or if you want to help with the
-implementation.
-
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-|Category | Feature | Status | Reviews |
-+==============================+==============================================================+==========================+=======================================================================+
-| atomic | 'compare' clause on atomic construct | :good:`done` | D120290, D120007, D118632, D120200, D116261, D118547, D116637 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| atomic | 'fail' clause on atomic construct | :part:`worked on` | D123235 (in progress) |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| base language | C++ attribute specifier syntax | :good:`done` | D105648 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | 'present' map type modifier | :good:`done` | D83061, D83062, D84422 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | 'present' motion modifier | :good:`done` | D84711, D84712 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | 'present' in defaultmap clause | :good:`done` | D92427 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | map clause reordering based on 'present' modifier | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | device-specific environment variables | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | omp_target_is_accessible routine | :part:`In Progress` | https://github.com/llvm/llvm-project/pull/138294 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | omp_get_mapped_ptr routine | :good:`done` | D141545 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | new async target memory copy routines | :good:`done` | D136103 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | thread_limit clause on target construct | :part:`partial` | D141540 (offload), D152054 (host, in progress) |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | has_device_addr clause on target construct | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | iterators in map clause or motion clauses | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | indirect clause on declare target directive | :part:`In Progress` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | allow virtual functions calls for mapped object on device | :part:`partial` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | interop construct | :part:`partial` | parsing/sema done: D98558, D98834, D98815 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | assorted routines for querying interoperable properties | :part:`partial` | D106674 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| loop | Loop tiling transformation | :good:`done` | D76342 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| loop | Loop unrolling transformation | :good:`done` | D99459 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| loop | 'reproducible'/'unconstrained' modifiers in 'order' clause | :part:`partial` | D127855 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| memory management | alignment for allocate directive and clause | :good:`done` | D115683 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| memory management | 'allocator' modifier for allocate clause | :good:`done` | https://github.com/llvm/llvm-project/pull/114883 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| memory management | 'align' modifier for allocate clause | :good:`done` | https://github.com/llvm/llvm-project/pull/121814 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| memory management | new memory management routines | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| memory management | changes to omp_alloctrait_key enum | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| memory model | seq_cst clause on flush construct | :good:`done` | https://github.com/llvm/llvm-project/pull/114072 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | 'omp_all_memory' keyword and use in 'depend' clause | :good:`done` | D125828, D126321 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | error directive | :good:`done` | D139166 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | scope construct | :good:`done` | D157933, https://github.com/llvm/llvm-project/pull/109197 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | routines for controlling and querying team regions | :part:`partial` | D95003 (libomp only) |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | changes to ompt_scope_endpoint_t enum | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | omp_display_env routine | :good:`done` | D74956 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | extended OMP_PLACES syntax | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT env vars | :good:`done` | D138769 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | 'target_device' selector in context specifier | :none:`worked on` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | begin/end declare variant | :good:`done` | D71179 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | dispatch construct and function variant argument adjustment | :part:`worked on` | D99537, D99679 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | assumes directives | :part:`worked on` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | assume directive | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | nothing directive | :good:`done` | D123286 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | masked construct and related combined constructs | :good:`done` | D99995, D100514, PR-121741(parallel_masked_taskloop) |
-| | | | PR-121746(parallel_masked_task_loop_simd),PR-121914(masked_taskloop) |
-| | | | PR-121916(masked_taskloop_simd) |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| misc | default(firstprivate) & default(private) | :good:`done` | D75591 (firstprivate), D125912 (private) |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| other | deprecating master construct | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| OMPT | new barrier types added to ompt_sync_region_t enum | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| OMPT | async data transfers added to ompt_target_data_op_t enum | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| OMPT | new barrier state values added to ompt_state_t enum | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| OMPT | new 'emi' callbacks for external monitoring interfaces | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| OMPT | device tracing interface | :none:`in progress` | jplehr |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | 'strict' modifier for taskloop construct | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | inoutset in depend clause | :good:`done` | D97085, D118383 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | nowait clause on taskwait | :part:`partial` | parsing/sema done: D131830, D141531 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-
-
-.. _OpenMP 5.2 implementation details:
-
-OpenMP 5.2 Implementation Details
-
-The following table provides a quick overview of various OpenMP 5.2 features
-and their implementation status. Please post on the
-`Discourse forums (Runtimes - OpenMP category)`_ for more
-information or if you want to help with the
-implementation.
-
-
-
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-|Feature | C/C++ Status | Fortran Status | Reviews |
-+=============================================================+===========================+===========================+==========================================================================+
-| omp_in_explicit_task() | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| semantics of explicit_task_var and implicit_task_var | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| ompx sentinel for C/C++ directive extensions | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| ompx prefix for clause extensions | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| if clause on teams construct | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| step modifier added | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| declare mapper: Add iterator modifier on map clause | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| declare mapper: Add iterator modifier on map clause | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| memspace and traits modifiers to uses allocator i | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Add otherwise clause to metadirectives | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| doacross clause with support for omp_cur_iteration | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| position of interop_type in init clause on iterop | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| implicit map type for target enter/exit data | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| work OMPT type for work-sharing loop constructs | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| allocate and firstprivate on scope directive | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Change loop consistency for order clause | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Add memspace and traits modifiers to uses_allocators | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Keep original base pointer on map w/o matched candidate | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Pure procedure support for certain directives | :none:`N/A` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| ALLOCATE statement support for allocators | :none:`N/A` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| dispatch construct extension to support end directive | :none:`N/A` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-
-
-
-.. _OpenMP 5.2 Deprecations:
-
-OpenMP 5.2 Deprecations
-
-
-
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| | C/C++ Status | Fortran Status | Reviews |
-+=============================================================+===========================+===========================+==========================================================================+
-| Linear clause syntax | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| The minus operator | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Map clause modifiers without commas | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| The use of allocate directives with ALLOCATE statement | :good:`N/A` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| uses_allocators list syntax | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| The default clause on metadirectives | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| The delimited form of the declare target directive | :none:`unclaimed` | :good:`N/A` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| The use of the to clause on the declare target directive | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| The syntax of the destroy clause on the depobj construct | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| keyword source and sink as task-dependence modifiers | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| interop types in any position on init clause of interop | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| ompd prefix usage for some ICVs | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-
-.. _OpenMP 6.0 implementation details:
-
-OpenMP 6.0 Implementation Details
-
-The following table provides a quick overview of various OpenMP 6.0 features
-and their implementation status. Please post on the
-`Discourse forums (Runtimes - OpenMP category)`_ for more
-information or if you want to help with the
-implementation.
-
-
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-|Feature | C/C++ Status | Fortran Status | Reviews |
-+=============================================================+===========================+===========================+==========================================================================+
-| free-agent threads | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| threadset clause | :part:`in progress` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Recording of task graphs | :part:`in progress` | :part:`in progress` | clang: jtb20, flang: kparzysz |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Parallel inductions | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| init_complete for scan directive | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| loop interchange transformation | :good:`done` | :none:`unclaimed` | Clang (interchange): https://github.com/llvm/llvm-project/pull/93022 |
-| | | | Clang (permutation): https://github.com/llvm/llvm-project/pull/92030 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| loop reverse transformation | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/92916 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| loop stripe transformation | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/119891 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| loop fusion transformation | :part:`in progress` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/139293 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| loop index set splitting transformation | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| loop transformation apply clause | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| loop fuse transformation | :good:`done` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| workdistribute construct | | :none:`in progress` | @skc7, @mjklemm |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| task_iteration | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| memscope clause for atomic and flush | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| transparent clause (hull tasks) | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| rule-based compound directives | :part:`In Progress` | :part:`In Progress` | kparzysz |
-| | | | Testing for Fortran missing |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| C23, C++23 | :none:`unclaimed` | | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Fortran 2023 | | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| decl attribute for declarative directives | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| C attribute syntax | :none:`unclaimed` | | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| pure directives in DO CONCURRENT | | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Optional argument for all clauses | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Function references for locator list items | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| All clauses accept directive name modifier | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Extensions to depobj construct | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Extensions to atomic construct | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Private reductions | :good:`mostly` | :none:`unclaimed` | Parse/Sema:https://github.com/llvm/llvm-project/pull/129938 |
-| | | | Codegen: https://github.com/llvm/llvm-project/pull/134709 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Self maps | :part:`partial` | :none:`unclaimed` | parsing/sema done: https://github.com/llvm/llvm-project/pull/129888 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Release map type for declare mapper | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Extensions to interop construct | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| no_openmp_constructs | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/125933 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| safe_sync and progress with identifier and API | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| OpenMP directives in concurrent loop regions | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/125621 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| atomics constructs on concurrent loop regions | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/125621 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Loop construct with DO CONCURRENT | | :part:`In Progress` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| device_type clause for target construct | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| nowait for ancestor target directives | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| New API for devices' num_teams/thread_limit | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Host and device environment variables | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| num_threads ICV and clause accepts list | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Numeric names for environment variables | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Increment between places for OMP_PLACES | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| OMP_AVAILABLE_DEVICES envirable | :none:`unclaimed` | :none:`unclaimed` | (should wait for "Traits for default device envirable" being done) |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Traits for default device envirable | :part:`in progress` | :none:`unclaimed` | ro-i |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Optionally omit array length expression | :good:`done` | :none:`unclaimed` | (Parse) https://github.com/llvm/llvm-project/pull/148048, |
-| | | | (Sema) https://github.com/llvm/llvm-project/pull/152786 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Canonical loop sequences | :part:`in progress` | :part:`in progress` | Clang: https://github.com/llvm/llvm-project/pull/139293 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Clarifications to Fortran map semantics | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| default clause at target construct | :part:`In Progress` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| ref count update use_device_{ptr, addr} | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Clarifications to implicit reductions | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| ref modifier for map clauses | :part:`In Progress` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| map-type modifiers in arbitrary position | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/90499 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Lift nesting restriction on concurrent loop | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/125621 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| priority clause for target constructs | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| changes to target_data construct | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Non-const do_not_sync for nowait/nogroup | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| need_device_addr modifier for adjust_args clause | :part:`partial` | :none:`unclaimed` | Parsing/Sema: https://github.com/llvm/llvm-project/pull/143442 |
-| | | | https://github.com/llvm/llvm-project/pull/149586 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Prescriptive num_threads | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/160659 |
-| | | | https://github.com/llvm/llvm-project/pull/146403 |
-| | | | https://github.com/llvm/llvm-project/pull/146404 |
-| | | | https://github.com/llvm/llvm-project/pull/146405 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Message and severity clauses | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/146093 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Local clause on declare target | :part:`In Progress` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| groupprivate directive | :part:`In Progress` | :part:`partial` | Flang: kparzysz, mjklemm |
-| | | | |
-| | | | Flang parser: https://github.com/llvm/llvm-project/pull/153807 |
-| | | | Flang sema: https://github.com/llvm/llvm-project/pull/154779 |
-| | | | Clang parse/sema: https://github.com/llvm/llvm-project/pull/158134 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| variable-category on default clause | :good:`done` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Changes to omp_target_is_accessible | :part:`In Progress` | :part:`In Progress` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| defaultmap implicit-behavior 'storage' | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/158336 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| defaultmap implicit-behavior 'private' | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/158712 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-
-.. _OpenMP 6.1 implementation details:
-
-OpenMP 6.1 Implementation Details (Experimental)
-
-The following table provides a quick overview over various OpenMP 6.1 features
-and their implementation status. Since OpenMP 6.1 has not yet been released, the
-following features are experimental and are subject to change at any time.
-Please post on the `Discourse forums (Runtimes - OpenMP category)`_ for more
-information or if you want to help with the
-implementation.
-
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-|Feature | C/C++ Status | Fortran Status | Reviews |
-+=============================================================+===========================+===========================+==========================================================================+
-| dyn_groupprivate clause | :part:`In Progress` | :part:`In Progress` | C/C++: kevinsala (https://github.com/llvm/llvm-project/pull/152651 |
-| | | | https://github.com/llvm/llvm-project/pull/152830 |
-| | | | https://github.com/llvm/llvm-project/pull/152831) |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| loop flatten transformation | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| loop grid/tile modifiers for sizes clause | :none:`unclaimed` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-
-
-OpenMP Extensions
-
-The following table provides a quick overview over various OpenMP
-extensions and their implementation status. These extensions are not
-currently defined by any standard, so links to associated LLVM
-documentation are provided. As these extensions mature, they will be
-considered for standardization. Please post on the
-`Discourse forums (Runtimes - OpenMP category)`_ to provide feedback.
-
-+------------------------------+-----------------------------------------------------------------------------------+--------------------------+--------------------------------------------------------+
-|Category | Feature | Status | Reviews |
-+==============================+===================================================================================+==========================+========================================================+
-| atomic extension | `'atomic' strictly nested within 'teams' | :good:`prototyped` | D126323 |
-| | <https://openmp.llvm.org/docs/openacc/OpenMPExtensions.html#atomicWithinTeams>`_ | | |
-+------------------------------+-----------------------------------------------------------------------------------+--------------------------+--------------------------------------------------------+
-| device extension | `'ompx_hold' map type modifier | :good:`prototyped` | D106509, D106510 |
-| | <https://openmp.llvm.org/docs/openacc/OpenMPExtensions.html#ompx-hold>`_ | | |
-+------------------------------+-----------------------------------------------------------------------------------+--------------------------+--------------------------------------------------------+
-| device extension | `'ompx_bare' clause on 'target teams' construct | :good:`prototyped` | #66844, #70612 |
-| | <https://www.osti.gov/servlets/purl/2205717>`_ | | |
-+------------------------------+-----------------------------------------------------------------------------------+--------------------------+--------------------------------------------------------+
-| device extension | Multi-dim 'num_teams' and 'thread_limit' clause on 'target teams ompx_bare' | :good:`partial` | #99732, #101407, #102715 |
-| | construct | | |
-+------------------------------+-----------------------------------------------------------------------------------+--------------------------+--------------------------------------------------------+
-
-.. _Discourse forums (Runtimes - OpenMP category): https://discourse.llvm.org/c/runtimes/openmp/35
-.. raw:: html
-
- <style type="text/css">
- .none { background-color: #FFCCCC }
- .part { background-color: #FFFF99 }
- .good { background-color: #CCFF99 }
- </style>
-
-.. role:: none
-.. role:: part
-.. role:: good
-
-.. contents::
- :local:
-
-OpenMP Support
-
-Clang fully supports OpenMP 4.5, almost all of 5.0 and most of 5.1/2.
-Clang supports offloading to X86_64, AArch64, PPC64[LE], NVIDIA GPUs (all models) and AMD GPUs (all models).
-
-In addition, the LLVM OpenMP runtime `libomp` supports the OpenMP Tools
-Interface (OMPT) on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and macOS.
-OMPT is also supported for NVIDIA and AMD GPUs.
-
-For the list of supported features from OpenMP 5.0 and 5.1
-see `OpenMP implementation details`_ and `OpenMP 51 implementation details`_.
-
-General improvements
-- New collapse clause scheme to avoid expensive remainder operations.
- Compute loop index variables after collapsing a loop nest via the
- collapse clause by replacing the expensive remainder operation with
- multiplications and additions.
-
-- When using the collapse clause on a loop nest the default behavior
- is to automatically extend the representation of the loop counter to
- 64 bits for the cases where the sizes of the collapsed loops are not
- known at compile time. To prevent this conservative choice and use
- at most 32 bits, compile your program with the
- `-fopenmp-optimistic-collapse`.
-
-
-GPU devices support
-
-Data-sharing modes
-------------------
-
-Clang supports two data-sharing models for Cuda devices: `Generic` and `Cuda`
-modes. The default mode is `Generic`. `Cuda` mode can give an additional
-performance and can be activated using the `-fopenmp-cuda-mode` flag. In
-`Generic` mode all local variables that can be shared in the parallel regions
-are stored in the global memory. In `Cuda` mode local variables are not shared
-between the threads and it is user responsibility to share the required data
-between the threads in the parallel regions. Often, the optimizer is able to
-reduce the cost of `Generic` mode to the level of `Cuda` mode, but the flag,
-as well as other assumption flags, can be used for tuning.
-
-Features not supported or with limited support for Cuda devices
----------------------------------------------------------------
-
-- Cancellation constructs are not supported.
-
-- Doacross loop nest is not supported.
-
-- User-defined reductions are supported only for trivial types.
-
-- Nested parallelism: inner parallel regions are executed sequentially.
-
-- Debug information for OpenMP target regions is supported, but sometimes it may
- be required to manually specify the address class of the inspected variables.
- In some cases the local variables are actually allocated in the global memory,
- but the debug info may be not aware of it.
-
-
-.. _OpenMP implementation details:
-
-OpenMP 5.0 Implementation Details
-
-The following table provides a quick overview over various OpenMP 5.0 features
-and their implementation status. Please post on the
-`Discourse forums (Runtimes - OpenMP category)`_ for more
-information or if you want to help with the
-implementation.
-
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-|Category | Feature | Status | Reviews |
-+==============================+==============================================================+==========================+=======================================================================+
-| loop | support != in the canonical loop form | :good:`done` | D54441 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| loop | #pragma omp loop (directive) | :part:`partial` | D145823 (combined forms) |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| loop | #pragma omp loop bind | :part:`worked on` | D144634 (needs review) |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| loop | collapse imperfectly nested loop | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| loop | collapse non-rectangular nested loop | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| loop | C++ range-base for loop | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| loop | clause: if for SIMD directives | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| loop | inclusive scan (matching C++17 PSTL) | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| memory management | memory allocators | :good:`done` | r341687,r357929 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| memory management | allocate directive and allocate clause | :good:`done` | r355614,r335952 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| OMPD | OMPD interfaces | :good:`done` | https://reviews.llvm.org/D99914 (Supports only HOST(CPU) and Linux |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| OMPT | OMPT interfaces (callback support) | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| thread affinity | thread affinity | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | taskloop reduction | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | task affinity | :part:`not upstream` | https://github.com/jklinkenberg/openmp/tree/task-affinity |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | clause: depend on the taskwait construct | :good:`done` | D113540 (regular codegen only) |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | depend objects and detachable tasks | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | mutexinoutset dependence-type for tasks | :good:`done` | D53380,D57576 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | combined taskloop constructs | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | master taskloop | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | parallel master taskloop | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | master taskloop simd | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| task | parallel master taskloop simd | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| SIMD | atomic and simd constructs inside SIMD code | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| SIMD | SIMD nontemporal | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | infer target functions from initializers | :part:`worked on` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | infer target variables from initializers | :good:`done` | D146418 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | OMP_TARGET_OFFLOAD environment variable | :good:`done` | D50522 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | support full 'defaultmap' functionality | :good:`done` | D69204 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | device specific functions | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: device_type | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: extended device | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: uses_allocators clause | :good:`done` | https://github.com/llvm/llvm-project/pull/157025 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: in_reduction | :part:`worked on` | r308768 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | omp_get_device_num() | :good:`done` | D54342,D128347 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | structure mapping of references | :none:`unclaimed` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | nested target declare | :good:`done` | D51378 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | implicitly map 'this' (this[:1]) | :good:`done` | D55982 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | allow access to the reference count (omp_target_is_present) | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | requires directive | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: unified_shared_memory | :good:`done` | D52625,D52359 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: unified_address | :part:`partial` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: reverse_offload | :part:`partial` | D52780,D155003 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: atomic_default_mem_order | :good:`done` | D53513 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: dynamic_allocators | :part:`unclaimed parts` | D53079 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | user-defined mappers | :good:`done` | D56326,D58638,D58523,D58074,D60972,D59474 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | map array-section with implicit mapper | :good:`done` | https://github.com/llvm/llvm-project/pull/101101 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | mapping lambda expression | :good:`done` | D51107 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: use_device_addr for target data | :good:`done` | |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | support close modifier on map clause | :good:`done` | D55719,D55892 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | teams construct on the host device | :good:`done` | r371553 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | support non-contiguous array sections for target update | :good:`done` | https://github.com/llvm/llvm-project/pull/144635 |
-+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | pointer attachment | :part:`being repaired` | @abhinavgaba (https://github.com/llvm/llvm-project/pull/153683) |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| atomic | hints for the atomic construct | :good:`done` | D51233 |
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 5f050f31b6993..25f3b4632d682 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -8638,13 +8638,8 @@ class MappableExprsHandler {
if (auto *IteratorExpr = dyn_cast<OMPIteratorExpr>(
C->getIteratorModifier()->IgnoreParenImpCasts())) {
const auto *VD =
- llvm::dyn_cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
+ cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
CGF.EmitVarDecl(*VD);
-
- OMPIteratorGeneratorScope IteratorScope(
- CGF, cast_or_null<OMPIteratorExpr>(
- IteratorExpr ? IteratorExpr->IgnoreParenImpCasts()
- : nullptr));
}
}
@@ -8669,13 +8664,8 @@ class MappableExprsHandler {
if (auto *IteratorExpr = dyn_cast<OMPIteratorExpr>(
C->getIteratorModifier()->IgnoreParenImpCasts())) {
const auto *VD =
- llvm::dyn_cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
+ cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
CGF.EmitVarDecl(*VD);
-
- OMPIteratorGeneratorScope IteratorScope(
- CGF, cast_or_null<OMPIteratorExpr>(
- IteratorExpr ? IteratorExpr->IgnoreParenImpCasts()
- : nullptr));
}
}
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 0b3d48a66f9b2..7b44c526fedfd 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4927,13 +4927,11 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
Data.MotionModifiersLoc.push_back(Tok.getLocation());
if (PP.getSpelling(Tok) == "iterator" && getLangOpts().OpenMP >= 51) {
ExprResult Tail;
- EnterScope(Scope::OpenMPDirectiveScope | Scope::DeclScope);
Tail = ParseOpenMPIteratorsExpr();
Tail = Actions.ActOnFinishFullExpr(Tail.get(), T.getOpenLocation(),
/*DiscardedValue=*/false);
- if (Tail.isUsable()) {
+ if (Tail.isUsable())
Data.IteratorExpr = Tail.get();
- }
} else {
ConsumeToken();
if (Modifier == OMPC_MOTION_MODIFIER_mapper) {
diff --git a/clang/test/OpenMP/target_update_iterator_serialization.cpp b/clang/test/OpenMP/target_update_iterator_serialization.cpp
new file mode 100644
index 0000000000000..c1ad380f7c9a5
--- /dev/null
+++ b/clang/test/OpenMP/target_update_iterator_serialization.cpp
@@ -0,0 +1,35 @@
+// Test without serialization:
+// RUN: %clang_cc1 -std=c++20 -fopenmp %s -ast-dump | FileCheck %s
+
+// Test with serialization:
+// RUN: %clang_cc1 -std=c++20 -fopenmp -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -std=c++20 -fopenmp -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
+
+// CHECK: OMPTargetUpdateDirective
+// CHECK-NEXT: OMPFromClause
+// CHECK-NEXT: ArraySubscriptExpr
+// CHECK: DeclRefExpr {{.*}} 'a'
+// CHECK: DeclRefExpr {{.*}} 'it'
+
+
+void foo1() {
+ int a[10];
+
+#pragma omp target update from(iterator(int it = 0:10) : a[it])
+ ;
+}
+
+// CHECK: OMPTargetUpdateDirective
+// CHECK-NEXT: OMPToClause
+// CHECK-NEXT: ArraySubscriptExpr
+// CHECK: DeclRefExpr {{.*}} 'a'
+// CHECK: DeclRefExpr {{.*}} 'it'
+
+void foo2() {
+ int a[10];
+
+#pragma omp target update to(iterator(int it = 0:10) : a[it])
+ ;
+}
>From 823fe2a84402a6cbc3e9fadbe5192a566d23f4d4 Mon Sep 17 00:00:00 2001
From: ShashwathiNavada <shashwathinavada at gmail.com>
Date: Thu, 20 Nov 2025 11:53:52 +0530
Subject: [PATCH 11/14] Update OpenMPSupport.rst
---
clang/docs/OpenMPSupport.rst | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 68c614646572b..c0191c272e914 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -13,7 +13,9 @@
.. contents::
:local:
+==============
OpenMP Support
+==============
Clang fully supports OpenMP 4.5, almost all of 5.0 and most of 5.1/2.
Clang supports offloading to X86_64, AArch64, PPC64[LE], NVIDIA GPUs (all models) and AMD GPUs (all models).
@@ -26,6 +28,7 @@ For the list of supported features from OpenMP 5.0 and 5.1
see `OpenMP implementation details`_ and `OpenMP 51 implementation details`_.
General improvements
+====================
- New collapse clause scheme to avoid expensive remainder operations.
Compute loop index variables after collapsing a loop nest via the
collapse clause by replacing the expensive remainder operation with
@@ -40,6 +43,7 @@ General improvements
GPU devices support
+===================
Data-sharing modes
------------------
@@ -74,6 +78,7 @@ Features not supported or with limited support for Cuda devices
.. _OpenMP implementation details:
OpenMP 5.0 Implementation Details
+=================================
The following table provides a quick overview over various OpenMP 5.0 features
and their implementation status. Please post on the
@@ -223,6 +228,7 @@ implementation.
.. _OpenMP 51 implementation details:
OpenMP 5.1 Implementation Details
+=================================
The following table provides a quick overview over various OpenMP 5.1 features
and their implementation status.
@@ -260,7 +266,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | has_device_addr clause on target construct | :none:`unclaimed` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | iterators in map clause or motion clauses | :none:`unclaimed` | |
+| device | iterators in map clause or motion clauses | :none:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | indirect clause on declare target directive | :part:`In Progress` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -345,6 +351,7 @@ implementation.
.. _OpenMP 5.2 implementation details:
OpenMP 5.2 Implementation Details
+=================================
The following table provides a quick overview of various OpenMP 5.2 features
and their implementation status. Please post on the
@@ -405,6 +412,7 @@ implementation.
.. _OpenMP 5.2 Deprecations:
OpenMP 5.2 Deprecations
+=======================
@@ -439,6 +447,7 @@ OpenMP 5.2 Deprecations
.. _OpenMP 6.0 implementation details:
OpenMP 6.0 Implementation Details
+=================================
The following table provides a quick overview of various OpenMP 6.0 features
and their implementation status. Please post on the
@@ -598,6 +607,7 @@ implementation.
.. _OpenMP 6.1 implementation details:
OpenMP 6.1 Implementation Details (Experimental)
+================================================
The following table provides a quick overview over various OpenMP 6.1 features
and their implementation status. Since OpenMP 6.1 has not yet been released, the
@@ -624,6 +634,7 @@ implementation.
OpenMP Extensions
+=================
The following table provides a quick overview over various OpenMP
extensions and their implementation status. These extensions are not
>From 67b2d49af33cb8bd6581b41053f69b92e435748c Mon Sep 17 00:00:00 2001
From: ShashwathiNavada <shashwathinavada at gmail.com>
Date: Thu, 20 Nov 2025 11:57:52 +0530
Subject: [PATCH 12/14] Update OpenMPSupport.rst
---
clang/docs/OpenMPSupport.rst | 54 ++++++++++--------------------------
1 file changed, 14 insertions(+), 40 deletions(-)
diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index c0191c272e914..a3e4272ceaf2f 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -153,7 +153,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | clause: extended device | :good:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: uses_allocators clause | :good:`done` | https://github.com/llvm/llvm-project/pull/157025 |
+| device | clause: uses_allocators clause | :good:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | clause: in_reduction | :part:`worked on` | r308768 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -193,7 +193,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | support non-contiguous array sections for target update | :good:`done` | https://github.com/llvm/llvm-project/pull/144635 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | pointer attachment | :part:`being repaired` | @abhinavgaba (https://github.com/llvm/llvm-project/pull/153683) |
+| device | pointer attachment | :good:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| atomic | hints for the atomic construct | :good:`done` | D51233 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -256,7 +256,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | device-specific environment variables | :none:`unclaimed` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | omp_target_is_accessible routine | :good:`done` | https://github.com/llvm/llvm-project/pull/138294 |
+| device | omp_target_is_accessible routine | :part:`In Progress` | https://github.com/llvm/llvm-project/pull/138294 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | omp_get_mapped_ptr routine | :good:`done` | D141545 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -266,7 +266,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | has_device_addr clause on target construct | :none:`unclaimed` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | iterators in map clause or motion clauses | :none:`done` | |
+| device | iterators in map clause or motion clauses | :good:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | indirect clause on declare target directive | :part:`In Progress` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -359,8 +359,6 @@ and their implementation status. Please post on the
information or if you want to help with the
implementation.
-
-
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
|Feature | C/C++ Status | Fortran Status | Reviews |
+=============================================================+===========================+===========================+==========================================================================+
@@ -407,17 +405,8 @@ implementation.
| dispatch construct extension to support end directive | :none:`N/A` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-
-
-.. _OpenMP 5.2 Deprecations:
-
-OpenMP 5.2 Deprecations
-=======================
-
-
-
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| | C/C++ Status | Fortran Status | Reviews |
+|OpenMP 5.2 Deprecations | C/C++ Status | Fortran Status | Reviews |
+=============================================================+===========================+===========================+==========================================================================+
| Linear clause syntax | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -455,13 +444,12 @@ and their implementation status. Please post on the
information or if you want to help with the
implementation.
-
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
|Feature | C/C++ Status | Fortran Status | Reviews |
+=============================================================+===========================+===========================+==========================================================================+
| free-agent threads | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| threadset clause | :part:`partial` | :none:`unclaimed` | Parse/Sema/Codegen : https://github.com/llvm/llvm-project/pull/13580 |
+| threadset clause | :part:`in progress` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Recording of task graphs | :part:`in progress` | :part:`in progress` | clang: jtb20, flang: kparzysz |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -482,8 +470,6 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| loop transformation apply clause | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| loop fuse transformation | :good:`done` | :none:`unclaimed` | |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| workdistribute construct | | :none:`in progress` | @skc7, @mjklemm |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| task_iteration | :none:`unclaimed` | :none:`unclaimed` | |
@@ -492,8 +478,7 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| transparent clause (hull tasks) | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| rule-based compound directives | :part:`In Progress` | :part:`In Progress` | kparzysz |
-| | | | Testing for Fortran missing |
+| rule-based compound directives | :none:`unclaimed` | :part:`In Progress` | Testing for Fortran missing |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| C23, C++23 | :none:`unclaimed` | | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -505,7 +490,7 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| pure directives in DO CONCURRENT | | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Optional argument for all clauses | :none:`partial` | :none:`In Progress` | Parse/Sema (nowait): https://github.com/llvm/llvm-project/pull/159628 |
+| Optional argument for all clauses | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Function references for locator list items | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -548,9 +533,9 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Increment between places for OMP_PLACES | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| OMP_AVAILABLE_DEVICES envirable | :none:`unclaimed` | :none:`unclaimed` | (should wait for "Traits for default device envirable" being done) |
+| OMP_AVAILABLE_DEVICES envirable | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Traits for default device envirable | :part:`in progress` | :none:`unclaimed` | ro-i |
+| Traits for default device envirable | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Optionally omit array length expression | :good:`done` | :none:`unclaimed` | (Parse) https://github.com/llvm/llvm-project/pull/148048, |
| | | | (Sema) https://github.com/llvm/llvm-project/pull/152786 |
@@ -559,7 +544,7 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Clarifications to Fortran map semantics | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| default clause at target construct | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/162910 |
+| default clause at target construct | :part:`In Progress` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| ref count update use_device_{ptr, addr} | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -580,12 +565,9 @@ implementation.
| need_device_addr modifier for adjust_args clause | :part:`partial` | :none:`unclaimed` | Parsing/Sema: https://github.com/llvm/llvm-project/pull/143442 |
| | | | https://github.com/llvm/llvm-project/pull/149586 |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Prescriptive num_threads | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/160659 |
-| | | | https://github.com/llvm/llvm-project/pull/146403 |
-| | | | https://github.com/llvm/llvm-project/pull/146404 |
-| | | | https://github.com/llvm/llvm-project/pull/146405 |
+| Prescriptive num_threads | :part:`In Progress` | :none:`unclaimed` | ro-i |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Message and severity clauses | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/146093 |
+| Message and severity clauses | :part:`In Progress` | :none:`unclaimed` | ro-i |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Local clause on declare target | :part:`In Progress` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -593,16 +575,12 @@ implementation.
| | | | |
| | | | Flang parser: https://github.com/llvm/llvm-project/pull/153807 |
| | | | Flang sema: https://github.com/llvm/llvm-project/pull/154779 |
-| | | | Clang parse/sema: https://github.com/llvm/llvm-project/pull/158134 |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| variable-category on default clause | :good:`done` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Changes to omp_target_is_accessible | :part:`In Progress` | :part:`In Progress` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| defaultmap implicit-behavior 'storage' | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/158336 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| defaultmap implicit-behavior 'private' | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/158712 |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
+
.. _OpenMP 6.1 implementation details:
@@ -627,10 +605,6 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| loop grid/tile modifiers for sizes clause | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| attach map-type modifier | :part:`In Progress` | :none:`unclaimed` | C/C++: @abhinavgaba; |
-| | | | RT: @abhinavgaba (https://github.com/llvm/llvm-project/pull/149036, |
-| | | | https://github.com/llvm/llvm-project/pull/158370) |
-+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
OpenMP Extensions
>From cb9caa2a746b5b94f13c23dcb093272e8759e704 Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Thu, 20 Nov 2025 00:35:30 -0600
Subject: [PATCH 13/14] Simple change
---
clang/docs/OpenMPSupport.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index a3e4272ceaf2f..0286722d4201e 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -266,7 +266,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | has_device_addr clause on target construct | :none:`unclaimed` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | iterators in map clause or motion clauses | :good:`done` | |
+| device | iterators in map clause or motion clauses | :none:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | indirect clause on declare target directive | :part:`In Progress` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
>From ea1f8ca4d0498b24531a7a5b1c63da1b27026fb5 Mon Sep 17 00:00:00 2001
From: Shashwathi N <nshashwa at pe31.hpc.amslabs.hpecorp.net>
Date: Thu, 20 Nov 2025 00:46:46 -0600
Subject: [PATCH 14/14] Formatting changes
---
clang/docs/OpenMPSupport.rst | 52 ++++++++++++++++++++-------
clang/lib/CodeGen/CGOpenMPRuntime.cpp | 6 ++--
2 files changed, 41 insertions(+), 17 deletions(-)
diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 0286722d4201e..c0191c272e914 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -153,7 +153,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | clause: extended device | :good:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | clause: uses_allocators clause | :good:`done` | |
+| device | clause: uses_allocators clause | :good:`done` | https://github.com/llvm/llvm-project/pull/157025 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | clause: in_reduction | :part:`worked on` | r308768 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -193,7 +193,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | support non-contiguous array sections for target update | :good:`done` | https://github.com/llvm/llvm-project/pull/144635 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | pointer attachment | :good:`done` | |
+| device | pointer attachment | :part:`being repaired` | @abhinavgaba (https://github.com/llvm/llvm-project/pull/153683) |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| atomic | hints for the atomic construct | :good:`done` | D51233 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -256,7 +256,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | device-specific environment variables | :none:`unclaimed` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
-| device | omp_target_is_accessible routine | :part:`In Progress` | https://github.com/llvm/llvm-project/pull/138294 |
+| device | omp_target_is_accessible routine | :good:`done` | https://github.com/llvm/llvm-project/pull/138294 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device | omp_get_mapped_ptr routine | :good:`done` | D141545 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -359,6 +359,8 @@ and their implementation status. Please post on the
information or if you want to help with the
implementation.
+
+
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
|Feature | C/C++ Status | Fortran Status | Reviews |
+=============================================================+===========================+===========================+==========================================================================+
@@ -405,8 +407,17 @@ implementation.
| dispatch construct extension to support end directive | :none:`N/A` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
+
+
+.. _OpenMP 5.2 Deprecations:
+
+OpenMP 5.2 Deprecations
+=======================
+
+
+
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-|OpenMP 5.2 Deprecations | C/C++ Status | Fortran Status | Reviews |
+| | C/C++ Status | Fortran Status | Reviews |
+=============================================================+===========================+===========================+==========================================================================+
| Linear clause syntax | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -444,12 +455,13 @@ and their implementation status. Please post on the
information or if you want to help with the
implementation.
+
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
|Feature | C/C++ Status | Fortran Status | Reviews |
+=============================================================+===========================+===========================+==========================================================================+
| free-agent threads | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| threadset clause | :part:`in progress` | :none:`unclaimed` | |
+| threadset clause | :part:`partial` | :none:`unclaimed` | Parse/Sema/Codegen : https://github.com/llvm/llvm-project/pull/13580 |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Recording of task graphs | :part:`in progress` | :part:`in progress` | clang: jtb20, flang: kparzysz |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -470,6 +482,8 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| loop transformation apply clause | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
+| loop fuse transformation | :good:`done` | :none:`unclaimed` | |
++-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| workdistribute construct | | :none:`in progress` | @skc7, @mjklemm |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| task_iteration | :none:`unclaimed` | :none:`unclaimed` | |
@@ -478,7 +492,8 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| transparent clause (hull tasks) | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| rule-based compound directives | :none:`unclaimed` | :part:`In Progress` | Testing for Fortran missing |
+| rule-based compound directives | :part:`In Progress` | :part:`In Progress` | kparzysz |
+| | | | Testing for Fortran missing |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| C23, C++23 | :none:`unclaimed` | | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -490,7 +505,7 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| pure directives in DO CONCURRENT | | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Optional argument for all clauses | :none:`unclaimed` | :none:`unclaimed` | |
+| Optional argument for all clauses | :none:`partial` | :none:`In Progress` | Parse/Sema (nowait): https://github.com/llvm/llvm-project/pull/159628 |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Function references for locator list items | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -533,9 +548,9 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Increment between places for OMP_PLACES | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| OMP_AVAILABLE_DEVICES envirable | :none:`unclaimed` | :none:`unclaimed` | |
+| OMP_AVAILABLE_DEVICES envirable | :none:`unclaimed` | :none:`unclaimed` | (should wait for "Traits for default device envirable" being done) |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Traits for default device envirable | :none:`unclaimed` | :none:`unclaimed` | |
+| Traits for default device envirable | :part:`in progress` | :none:`unclaimed` | ro-i |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Optionally omit array length expression | :good:`done` | :none:`unclaimed` | (Parse) https://github.com/llvm/llvm-project/pull/148048, |
| | | | (Sema) https://github.com/llvm/llvm-project/pull/152786 |
@@ -544,7 +559,7 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Clarifications to Fortran map semantics | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| default clause at target construct | :part:`In Progress` | :none:`unclaimed` | |
+| default clause at target construct | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/162910 |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| ref count update use_device_{ptr, addr} | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -565,9 +580,12 @@ implementation.
| need_device_addr modifier for adjust_args clause | :part:`partial` | :none:`unclaimed` | Parsing/Sema: https://github.com/llvm/llvm-project/pull/143442 |
| | | | https://github.com/llvm/llvm-project/pull/149586 |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Prescriptive num_threads | :part:`In Progress` | :none:`unclaimed` | ro-i |
+| Prescriptive num_threads | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/160659 |
+| | | | https://github.com/llvm/llvm-project/pull/146403 |
+| | | | https://github.com/llvm/llvm-project/pull/146404 |
+| | | | https://github.com/llvm/llvm-project/pull/146405 |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-| Message and severity clauses | :part:`In Progress` | :none:`unclaimed` | ro-i |
+| Message and severity clauses | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/146093 |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Local clause on declare target | :part:`In Progress` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -575,12 +593,16 @@ implementation.
| | | | |
| | | | Flang parser: https://github.com/llvm/llvm-project/pull/153807 |
| | | | Flang sema: https://github.com/llvm/llvm-project/pull/154779 |
+| | | | Clang parse/sema: https://github.com/llvm/llvm-project/pull/158134 |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| variable-category on default clause | :good:`done` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| Changes to omp_target_is_accessible | :part:`In Progress` | :part:`In Progress` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
-
+| defaultmap implicit-behavior 'storage' | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/158336 |
++-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
+| defaultmap implicit-behavior 'private' | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/158712 |
++-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
.. _OpenMP 6.1 implementation details:
@@ -605,6 +627,10 @@ implementation.
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
| loop grid/tile modifiers for sizes clause | :none:`unclaimed` | :none:`unclaimed` | |
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
+| attach map-type modifier | :part:`In Progress` | :none:`unclaimed` | C/C++: @abhinavgaba; |
+| | | | RT: @abhinavgaba (https://github.com/llvm/llvm-project/pull/149036, |
+| | | | https://github.com/llvm/llvm-project/pull/158370) |
++-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
OpenMP Extensions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 25f3b4632d682..cb93491ec27da 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -8637,8 +8637,7 @@ class MappableExprsHandler {
OMPC_MOTION_MODIFIER_iterator)) {
if (auto *IteratorExpr = dyn_cast<OMPIteratorExpr>(
C->getIteratorModifier()->IgnoreParenImpCasts())) {
- const auto *VD =
- cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
+ const auto *VD = cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
CGF.EmitVarDecl(*VD);
}
}
@@ -8663,8 +8662,7 @@ class MappableExprsHandler {
OMPC_MOTION_MODIFIER_iterator)) {
if (auto *IteratorExpr = dyn_cast<OMPIteratorExpr>(
C->getIteratorModifier()->IgnoreParenImpCasts())) {
- const auto *VD =
- cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
+ const auto *VD = cast<VarDecl>(IteratorExpr->getIteratorDecl(0));
CGF.EmitVarDecl(*VD);
}
}
More information about the cfe-commits
mailing list