Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e0d9c9c
[MLIR] Apply clang-tidy fixes for llvm-qualified-auto in Vectorizatio…
joker-eph Aug 21, 2025
4d7093b
[AMDGPU] Enable "amdgpu-uniform-intrinsic-combine" pass in pipeline. …
PankajDwivedi-25 Oct 30, 2025
98ceb45
[mlir] Fix use-after-move issues (#165660)
noclowns Oct 30, 2025
67db5fd
[clang] Add Bytes/Columns types to TextDiagnostic (#165541)
tbaederr Oct 30, 2025
44f5ae3
[utils][UpdateTestChecks] Extract MIR functionality into separate mir…
vpykhtin Oct 30, 2025
e760542
[clang] Update C++ DR status page
Endilll Oct 30, 2025
31890c5
[AArch64][GlobalISel] Add some GISel test coverage for icmp-and tests…
davemgreen Oct 30, 2025
30579c0
[DebugInfo] Add bit size to _BitInt name in debug info (#165583)
OCHyams Oct 30, 2025
8f62481
[MemCpyOpt] Allow stack move optimization if one address captured (#1…
nikic Oct 30, 2025
43ea75d
[DeveloperPolicy] Add guidelines for adding/enabling passes (#158591)
nikic Oct 30, 2025
bb1158f
[libc++] Fix LLVM 22 TODOs (#153367)
philnik777 Oct 30, 2025
689e95c
[GVN] Add tests for pointer replacement with different addr size (NFC)
nikic Oct 30, 2025
eccbfde
[AMDGPU] insert eof white space (#165673)
PankajDwivedi-25 Oct 30, 2025
932fa0e
[ORC] Fix missing include for MemoryAccess interface (NFC) (#165576)
weliveindetail Oct 30, 2025
96feee4
[clang][NFC] Make ellipse strings constexpr (#165680)
tbaederr Oct 30, 2025
25ece5b
[clang][OpenMP] New OpenMP 6.0 threadset clause (#135807)
Ritanya-B-Bharadwaj Oct 30, 2025
f205be0
Revert "[lldb-dap] Improving consistency of tests by removing concurr…
DavidSpickett Oct 30, 2025
838f643
[lldb-dap][test] skip io_redirection in debug builds (#165593)
da-viper Oct 30, 2025
d929146
[Clang][AArch64] Lower NEON vaddv/vminv/vmaxv builtins to llvm.vector…
paulwalker-arm Oct 30, 2025
0e2b890
[DA] Add tests where dependencies are missed due to overflow (NFC) (#…
kasuga-fj Oct 30, 2025
41cdd0b
merge main into amd-staging
z1-cciauto Oct 30, 2025
63d59cb
Xfail: downstream test:readfirstlanes llvm/test/CodeGen/AMDGPU/fold-r…
ronlieb Oct 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,324 changes: 662 additions & 662 deletions clang/docs/OpenMPSupport.rst

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ OpenMP Support
modifier in the ``adjust_args`` clause.
- Allow array length to be omitted in array section subscript expression.
- Fixed non-contiguous strided update in the ``omp target update`` directive with the ``from`` clause.
- Added support for threadset clause in task and taskloop directives.
- Properly handle array section/assumed-size array privatization in C/C++.
- Added support to handle new syntax of the ``uses_allocators`` clause.
- Added support for ``variable-category`` modifier in ``default clause``.
Expand Down
80 changes: 80 additions & 0 deletions clang/include/clang/AST/OpenMPClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,86 @@ class OMPDefaultClause : public OMPClause {
}
};

/// This represents 'threadset' clause in the '#pragma omp task ...' directive.
///
/// \code
/// #pragma omp task threadset(omp_pool)
/// \endcode
/// In this example directive '#pragma omp task' has simple 'threadset'
/// clause with kind 'omp_pool'.
class OMPThreadsetClause final : public OMPClause {
friend class OMPClauseReader;

/// Location of '('.
SourceLocation LParenLoc;

/// A kind of the 'threadset' clause.
OpenMPThreadsetKind Kind = OMPC_THREADSET_unknown;

/// Start location of the kind in source code.
SourceLocation KindLoc;

/// Set kind of the clauses.
///
/// \param K Argument of clause.
void setThreadsetKind(OpenMPThreadsetKind K) { Kind = K; }

/// Set argument location.
///
/// \param KLoc Argument location.
void setThreadsetKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }

public:
/// Build 'threadset' clause with argument \a A ('omp_team' or 'omp_pool').
///
/// \param A Argument of the clause ('omp_team' or 'omp_pool').
/// \param ALoc Starting location of the argument.
/// \param StartLoc Starting location of the clause.
/// \param LParenLoc Location of '('.
/// \param EndLoc Ending location of the clause.
OMPThreadsetClause(OpenMPThreadsetKind A, SourceLocation ALoc,
SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc)
: OMPClause(llvm::omp::OMPC_threadset, StartLoc, EndLoc),
LParenLoc(LParenLoc), Kind(A), KindLoc(ALoc) {}

/// Build an empty clause.
OMPThreadsetClause()
: OMPClause(llvm::omp::OMPC_threadset, SourceLocation(),
SourceLocation()) {}

/// Sets the location of '('.
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }

/// Returns the location of '('.
SourceLocation getLParenLoc() const { return LParenLoc; }

/// Returns kind of the clause.
OpenMPThreadsetKind getThreadsetKind() const { return Kind; }

/// Returns location of clause kind.
SourceLocation getThreadsetKindLoc() const { return KindLoc; }

child_range children() {
return child_range(child_iterator(), child_iterator());
}

const_child_range children() const {
return const_child_range(const_child_iterator(), const_child_iterator());
}

child_range used_children() {
return child_range(child_iterator(), child_iterator());
}
const_child_range used_children() const {
return const_child_range(const_child_iterator(), const_child_iterator());
}

static bool classof(const OMPClause *T) {
return T->getClauseKind() == llvm::omp::OMPC_threadset;
}
};

/// This represents 'proc_bind' clause in the '#pragma omp ...'
/// directive.
///
Expand Down
6 changes: 6 additions & 0 deletions clang/include/clang/AST/RecursiveASTVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3523,6 +3523,12 @@ bool RecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *) {
return true;
}

template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPThreadsetClause(
OMPThreadsetClause *) {
return true;
}

template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPProcBindClause(OMPProcBindClause *) {
return true;
Expand Down
8 changes: 7 additions & 1 deletion clang/include/clang/Basic/OpenMPKinds.def
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
#ifndef OPENMP_ALLOCATE_MODIFIER
#define OPENMP_ALLOCATE_MODIFIER(Name)
#endif
#ifndef OPENMP_THREADSET_KIND
#define OPENMP_THREADSET_KIND(Name)
#endif

// Static attributes for 'schedule' clause.
OPENMP_SCHEDULE_KIND(static)
Expand Down Expand Up @@ -255,6 +258,9 @@ OPENMP_DOACROSS_MODIFIER(sink)
OPENMP_DOACROSS_MODIFIER(sink_omp_cur_iteration)
OPENMP_DOACROSS_MODIFIER(source_omp_cur_iteration)

OPENMP_THREADSET_KIND(omp_pool)
OPENMP_THREADSET_KIND(omp_team)

#undef OPENMP_NUMTASKS_MODIFIER
#undef OPENMP_NUMTHREADS_MODIFIER
#undef OPENMP_GRAINSIZE_MODIFIER
Expand Down Expand Up @@ -284,4 +290,4 @@ OPENMP_DOACROSS_MODIFIER(source_omp_cur_iteration)
#undef OPENMP_DEFAULTMAP_MODIFIER
#undef OPENMP_DOACROSS_MODIFIER
#undef OPENMP_ALLOCATE_MODIFIER

#undef OPENMP_THREADSET_KIND
7 changes: 7 additions & 0 deletions clang/include/clang/Basic/OpenMPKinds.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@ enum OpenMPAllocateClauseModifier {
OMPC_ALLOCATE_unknown
};

/// OpenMP modifiers for 'threadset' clause.
enum OpenMPThreadsetKind {
#define OPENMP_THREADSET_KIND(Name) OMPC_THREADSET_##Name,
#include "clang/Basic/OpenMPKinds.def"
OMPC_THREADSET_unknown
};

/// Number of allowed allocate-modifiers.
static constexpr unsigned NumberOfOMPAllocateClauseModifiers =
OMPC_ALLOCATE_unknown;
Expand Down
6 changes: 6 additions & 0 deletions clang/include/clang/Sema/SemaOpenMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,12 @@ class SemaOpenMP : public SemaBase {
OpenMPDefaultClauseVariableCategory VCKind,
SourceLocation VCKindLoc, SourceLocation StartLoc,
SourceLocation LParenLoc, SourceLocation EndLoc);
/// Called on well-formed 'threadset' clause.
OMPClause *ActOnOpenMPThreadsetClause(OpenMPThreadsetKind Kind,
SourceLocation KindLoc,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc);
/// Called on well-formed 'proc_bind' clause.
OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
SourceLocation KindLoc,
Expand Down
8 changes: 8 additions & 0 deletions clang/lib/AST/OpenMPClause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
case OMPC_nowait:
case OMPC_untied:
case OMPC_mergeable:
case OMPC_threadset:
case OMPC_threadprivate:
case OMPC_groupprivate:
case OMPC_flush:
Expand Down Expand Up @@ -2035,6 +2036,13 @@ void OMPClausePrinter::VisitOMPDefaultClause(OMPDefaultClause *Node) {
OS << ")";
}

void OMPClausePrinter::VisitOMPThreadsetClause(OMPThreadsetClause *Node) {
OS << "threadset("
<< getOpenMPSimpleClauseTypeName(OMPC_threadset,
unsigned(Node->getThreadsetKind()))
<< ")";
}

void OMPClausePrinter::VisitOMPProcBindClause(OMPProcBindClause *Node) {
OS << "proc_bind("
<< getOpenMPSimpleClauseTypeName(OMPC_proc_bind,
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/AST/StmtProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,8 @@ void OMPClauseProfiler::VisitOMPNocontextClause(const OMPNocontextClause *C) {

void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }

void OMPClauseProfiler::VisitOMPThreadsetClause(const OMPThreadsetClause *C) {}

void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { }

void OMPClauseProfiler::VisitOMPUnifiedAddressClause(
Expand Down
19 changes: 19 additions & 0 deletions clang/lib/Basic/OpenMPKinds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, StringRef Str,
#define OPENMP_ALLOCATE_MODIFIER(Name) .Case(#Name, OMPC_ALLOCATE_##Name)
#include "clang/Basic/OpenMPKinds.def"
.Default(OMPC_ALLOCATE_unknown);
case OMPC_threadset: {
unsigned Type = llvm::StringSwitch<unsigned>(Str)
#define OPENMP_THREADSET_KIND(Name) .Case(#Name, OMPC_THREADSET_##Name)
#include "clang/Basic/OpenMPKinds.def"
.Default(OMPC_THREADSET_unknown);
if (LangOpts.OpenMP < 60)
return OMPC_THREADSET_unknown;
return Type;
}
case OMPC_num_threads: {
unsigned Type = llvm::StringSwitch<unsigned>(Str)
#define OPENMP_NUMTHREADS_MODIFIER(Name) .Case(#Name, OMPC_NUMTHREADS_##Name)
Expand Down Expand Up @@ -565,6 +574,16 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
#include "clang/Basic/OpenMPKinds.def"
}
llvm_unreachable("Invalid OpenMP 'num_threads' clause modifier");
case OMPC_threadset:
switch (Type) {
case OMPC_THREADSET_unknown:
return "unknown";
#define OPENMP_THREADSET_KIND(Name) \
case OMPC_THREADSET_##Name: \
return #Name;
#include "clang/Basic/OpenMPKinds.def"
}
llvm_unreachable("Invalid OpenMP 'threadset' clause modifier");
case OMPC_unknown:
case OMPC_threadprivate:
case OMPC_groupprivate:
Expand Down
5 changes: 4 additions & 1 deletion clang/lib/CodeGen/CGDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,10 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
}

llvm::DIType *CGDebugInfo::CreateType(const BitIntType *Ty) {
StringRef Name = Ty->isUnsigned() ? "unsigned _BitInt" : "_BitInt";
SmallString<32> Name;
llvm::raw_svector_ostream OS(Name);
OS << (Ty->isUnsigned() ? "unsigned _BitInt(" : "_BitInt(")
<< Ty->getNumBits() << ")";
llvm::dwarf::TypeKind Encoding = Ty->isUnsigned()
? llvm::dwarf::DW_ATE_unsigned
: llvm::dwarf::DW_ATE_signed;
Expand Down
6 changes: 6 additions & 0 deletions clang/lib/CodeGen/CGOpenMPRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3778,6 +3778,7 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc,
DestructorsFlag = 0x8,
PriorityFlag = 0x20,
DetachableFlag = 0x40,
FreeAgentFlag = 0x80,
};
unsigned Flags = Data.Tied ? TiedFlag : 0;
bool NeedsCleanup = false;
Expand All @@ -3787,6 +3788,11 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc,
if (NeedsCleanup)
Flags = Flags | DestructorsFlag;
}
if (const auto *Clause = D.getSingleClause<OMPThreadsetClause>()) {
OpenMPThreadsetKind Kind = Clause->getThreadsetKind();
if (Kind == OMPC_THREADSET_omp_pool)
Flags = Flags | FreeAgentFlag;
}
if (Data.Priority.getInt())
Flags = Flags | PriorityFlag;
if (D.hasClausesOfKind<OMPDetachClause>())
Expand Down
Loading