Skip to content

Commit df129e8

Browse files
committed
merge main into amd-staging
Change-Id: I2e9ecaee65ccd82f4a15a08cc5368520ee9134b5
2 parents fa7007d + 18de1db commit df129e8

File tree

417 files changed

+6647
-3568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

417 files changed

+6647
-3568
lines changed

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ RUN apt-get update && \
5757
nodejs \
5858
perl-modules \
5959
python3-psutil \
60+
sudo \
6061

6162
# These are needed by the premerge pipeline. Pip is used to install
6263
# dependent python packages and ccache is used for build caching. File and
@@ -73,5 +74,11 @@ ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
7374
# permissions issues in some tests. Set the user id to 1001 as that is the
7475
# user id that Github Actions uses to perform the checkout action.
7576
RUN useradd gha -u 1001 -m -s /bin/bash
77+
78+
# Also add the user to passwordless sudoers so that we can install software
79+
# later on without having to rebuild the container.
80+
RUN adduser gha sudo
81+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
82+
7683
USER gha
7784

clang/include/clang/AST/OpenACCClause.h

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,18 +327,89 @@ class OpenACCIfClause : public OpenACCClauseWithCondition {
327327
SourceLocation EndLoc);
328328
};
329329

330-
/// A 'self' clause, which has an optional condition expression.
331-
class OpenACCSelfClause : public OpenACCClauseWithCondition {
330+
/// A 'self' clause, which has an optional condition expression, or, in the
331+
/// event of an 'update' directive, contains a 'VarList'.
332+
class OpenACCSelfClause final
333+
: public OpenACCClauseWithParams,
334+
private llvm::TrailingObjects<OpenACCSelfClause, Expr *> {
335+
friend TrailingObjects;
336+
// Holds whether this HAS a condition expression. Lacks a value if this is NOT
337+
// a condition-expr self clause.
338+
std::optional<bool> HasConditionExpr;
339+
// Holds the number of stored expressions. In the case of a condition-expr
340+
// self clause, this is expected to be ONE (and there to be 1 trailing
341+
// object), whether or not that is null.
342+
unsigned NumExprs;
343+
332344
OpenACCSelfClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
333345
Expr *ConditionExpr, SourceLocation EndLoc);
346+
OpenACCSelfClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
347+
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
348+
349+
// Intentionally internal, meant to be an implementation detail of everything
350+
// else. All non-internal uses should go through getConditionExpr/getVarList.
351+
llvm::ArrayRef<Expr *> getExprs() const {
352+
return {getTrailingObjects<Expr *>(), NumExprs};
353+
}
334354

335355
public:
336356
static bool classof(const OpenACCClause *C) {
337357
return C->getClauseKind() == OpenACCClauseKind::Self;
338358
}
359+
360+
bool isConditionExprClause() const { return HasConditionExpr.has_value(); }
361+
362+
bool hasConditionExpr() const {
363+
assert(HasConditionExpr.has_value() &&
364+
"VarList Self Clause asked about condition expression");
365+
return *HasConditionExpr;
366+
}
367+
368+
const Expr *getConditionExpr() const {
369+
assert(HasConditionExpr.has_value() &&
370+
"VarList Self Clause asked about condition expression");
371+
assert(getExprs().size() == 1 &&
372+
"ConditionExpr Self Clause with too many Exprs");
373+
return getExprs()[0];
374+
}
375+
376+
Expr *getConditionExpr() {
377+
assert(HasConditionExpr.has_value() &&
378+
"VarList Self Clause asked about condition expression");
379+
assert(getExprs().size() == 1 &&
380+
"ConditionExpr Self Clause with too many Exprs");
381+
return getExprs()[0];
382+
}
383+
384+
ArrayRef<Expr *> getVarList() {
385+
assert(!HasConditionExpr.has_value() &&
386+
"Condition Expr self clause asked about var list");
387+
return getExprs();
388+
}
389+
ArrayRef<Expr *> getVarList() const {
390+
assert(!HasConditionExpr.has_value() &&
391+
"Condition Expr self clause asked about var list");
392+
return getExprs();
393+
}
394+
395+
child_range children() {
396+
return child_range(
397+
reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>()),
398+
reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>() + NumExprs));
399+
}
400+
401+
const_child_range children() const {
402+
child_range Children = const_cast<OpenACCSelfClause *>(this)->children();
403+
return const_child_range(Children.begin(), Children.end());
404+
}
405+
339406
static OpenACCSelfClause *Create(const ASTContext &C, SourceLocation BeginLoc,
340407
SourceLocation LParenLoc,
341408
Expr *ConditionExpr, SourceLocation EndLoc);
409+
static OpenACCSelfClause *Create(const ASTContext &C, SourceLocation BeginLoc,
410+
SourceLocation LParenLoc,
411+
ArrayRef<Expr *> ConditionExpr,
412+
SourceLocation EndLoc);
342413
};
343414

344415
/// Represents a clause that has one or more expressions associated with it.

clang/include/clang/Basic/TargetInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ class TargetInfo : public TransferrableTargetInfo,
15311531

15321532
// Return the target-specific priority for features/cpus/vendors so
15331533
// that they can be properly sorted for checking.
1534-
virtual unsigned getFMVPriority(ArrayRef<StringRef> Features) const {
1534+
virtual uint64_t getFMVPriority(ArrayRef<StringRef> Features) const {
15351535
return 0;
15361536
}
15371537

clang/include/clang/Sema/Sema.h

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13062,7 +13062,6 @@ class Sema final : public SemaBase {
1306213062
///
1306313063
/// \param SkipForSpecialization when specified, any template specializations
1306413064
/// in a traversal would be ignored.
13065-
///
1306613065
/// \param ForDefaultArgumentSubstitution indicates we should continue looking
1306713066
/// when encountering a specialized member function template, rather than
1306813067
/// returning immediately.
@@ -13074,17 +13073,6 @@ class Sema final : public SemaBase {
1307413073
bool SkipForSpecialization = false,
1307513074
bool ForDefaultArgumentSubstitution = false);
1307613075

13077-
/// Apart from storing the result to \p Result, this behaves the same as
13078-
/// another overload.
13079-
void getTemplateInstantiationArgs(
13080-
MultiLevelTemplateArgumentList &Result, const NamedDecl *D,
13081-
const DeclContext *DC = nullptr, bool Final = false,
13082-
std::optional<ArrayRef<TemplateArgument>> Innermost = std::nullopt,
13083-
bool RelativeToPrimary = false, const FunctionDecl *Pattern = nullptr,
13084-
bool ForConstraintInstantiation = false,
13085-
bool SkipForSpecialization = false,
13086-
bool ForDefaultArgumentSubstitution = false);
13087-
1308813076
/// RAII object to handle the state changes required to synthesize
1308913077
/// a function body.
1309013078
class SynthesizedFunctionScope {
@@ -13354,7 +13342,7 @@ class Sema final : public SemaBase {
1335413342
ExprResult
1335513343
SubstConstraintExpr(Expr *E,
1335613344
const MultiLevelTemplateArgumentList &TemplateArgs);
13357-
// Unlike the above, this does not evaluate constraints.
13345+
// Unlike the above, this does not evaluates constraints.
1335813346
ExprResult SubstConstraintExprWithoutSatisfaction(
1335913347
Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs);
1336013348

@@ -14475,10 +14463,10 @@ class Sema final : public SemaBase {
1447514463
const MultiLevelTemplateArgumentList &TemplateArgs,
1447614464
SourceRange TemplateIDRange);
1447714465

14478-
bool CheckFunctionTemplateConstraints(SourceLocation PointOfInstantiation,
14479-
FunctionDecl *Decl,
14480-
ArrayRef<TemplateArgument> TemplateArgs,
14481-
ConstraintSatisfaction &Satisfaction);
14466+
bool CheckInstantiatedFunctionTemplateConstraints(
14467+
SourceLocation PointOfInstantiation, FunctionDecl *Decl,
14468+
ArrayRef<TemplateArgument> TemplateArgs,
14469+
ConstraintSatisfaction &Satisfaction);
1448214470

1448314471
/// \brief Emit diagnostics explaining why a constraint expression was deemed
1448414472
/// unsatisfied.

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ class SemaOpenACC : public SemaBase {
409409
ClauseKind == OpenACCClauseKind::Detach ||
410410
ClauseKind == OpenACCClauseKind::DevicePtr ||
411411
ClauseKind == OpenACCClauseKind::Reduction ||
412+
(ClauseKind == OpenACCClauseKind::Self &&
413+
DirKind == OpenACCDirectiveKind::Update) ||
412414
ClauseKind == OpenACCClauseKind::FirstPrivate) &&
413415
"Parsed clause kind does not have a var-list");
414416

@@ -551,6 +553,8 @@ class SemaOpenACC : public SemaBase {
551553
ClauseKind == OpenACCClauseKind::UseDevice ||
552554
ClauseKind == OpenACCClauseKind::Detach ||
553555
ClauseKind == OpenACCClauseKind::DevicePtr ||
556+
(ClauseKind == OpenACCClauseKind::Self &&
557+
DirKind == OpenACCDirectiveKind::Update) ||
554558
ClauseKind == OpenACCClauseKind::FirstPrivate) &&
555559
"Parsed clause kind does not have a var-list");
556560
assert((!IsReadOnly || ClauseKind == OpenACCClauseKind::CopyIn ||
@@ -590,6 +594,8 @@ class SemaOpenACC : public SemaBase {
590594
ClauseKind == OpenACCClauseKind::UseDevice ||
591595
ClauseKind == OpenACCClauseKind::Detach ||
592596
ClauseKind == OpenACCClauseKind::DevicePtr ||
597+
(ClauseKind == OpenACCClauseKind::Self &&
598+
DirKind == OpenACCDirectiveKind::Update) ||
593599
ClauseKind == OpenACCClauseKind::FirstPrivate) &&
594600
"Parsed clause kind does not have a var-list");
595601
assert((!IsReadOnly || ClauseKind == OpenACCClauseKind::CopyIn ||

clang/include/clang/Sema/Template.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,6 @@ enum class TemplateSubstitutionKind : char {
522522
llvm::PointerUnion<Decl *, DeclArgumentPack *> *
523523
findInstantiationOf(const Decl *D);
524524

525-
/// Similar to \p findInstantiationOf(), but it wouldn't assert if the
526-
/// instantiation was not found within the current instantiation scope. This
527-
/// is helpful for on-demand declaration instantiation.
528-
llvm::PointerUnion<Decl *, DeclArgumentPack *> *
529-
findInstantiationUnsafe(const Decl *D);
530-
531525
void InstantiatedLocal(const Decl *D, Decl *Inst);
532526
void InstantiatedLocalPackArg(const Decl *D, VarDecl *Inst);
533527
void MakeInstantiatedLocalArgPack(const Decl *D);

clang/lib/AST/OpenACCClause.cpp

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ using namespace clang;
2020
bool OpenACCClauseWithParams::classof(const OpenACCClause *C) {
2121
return OpenACCDeviceTypeClause::classof(C) ||
2222
OpenACCClauseWithCondition::classof(C) ||
23-
OpenACCClauseWithExprs::classof(C);
23+
OpenACCClauseWithExprs::classof(C) || OpenACCSelfClause::classof(C);
2424
}
2525
bool OpenACCClauseWithExprs::classof(const OpenACCClause *C) {
2626
return OpenACCWaitClause::classof(C) || OpenACCNumGangsClause::classof(C) ||
@@ -41,7 +41,7 @@ bool OpenACCClauseWithVarList::classof(const OpenACCClause *C) {
4141
OpenACCReductionClause::classof(C) || OpenACCCreateClause::classof(C);
4242
}
4343
bool OpenACCClauseWithCondition::classof(const OpenACCClause *C) {
44-
return OpenACCIfClause::classof(C) || OpenACCSelfClause::classof(C);
44+
return OpenACCIfClause::classof(C);
4545
}
4646
bool OpenACCClauseWithSingleIntExpr::classof(const OpenACCClause *C) {
4747
return OpenACCNumWorkersClause::classof(C) ||
@@ -87,19 +87,43 @@ OpenACCSelfClause *OpenACCSelfClause::Create(const ASTContext &C,
8787
SourceLocation LParenLoc,
8888
Expr *ConditionExpr,
8989
SourceLocation EndLoc) {
90-
void *Mem = C.Allocate(sizeof(OpenACCIfClause), alignof(OpenACCIfClause));
90+
void *Mem = C.Allocate(OpenACCSelfClause::totalSizeToAlloc<Expr *>(1));
9191
return new (Mem)
9292
OpenACCSelfClause(BeginLoc, LParenLoc, ConditionExpr, EndLoc);
9393
}
9494

95+
OpenACCSelfClause *OpenACCSelfClause::Create(const ASTContext &C,
96+
SourceLocation BeginLoc,
97+
SourceLocation LParenLoc,
98+
ArrayRef<Expr *> VarList,
99+
SourceLocation EndLoc) {
100+
void *Mem =
101+
C.Allocate(OpenACCSelfClause::totalSizeToAlloc<Expr *>(VarList.size()));
102+
return new (Mem) OpenACCSelfClause(BeginLoc, LParenLoc, VarList, EndLoc);
103+
}
104+
105+
OpenACCSelfClause::OpenACCSelfClause(SourceLocation BeginLoc,
106+
SourceLocation LParenLoc,
107+
llvm::ArrayRef<Expr *> VarList,
108+
SourceLocation EndLoc)
109+
: OpenACCClauseWithParams(OpenACCClauseKind::Self, BeginLoc, LParenLoc,
110+
EndLoc),
111+
HasConditionExpr(std::nullopt), NumExprs(VarList.size()) {
112+
std::uninitialized_copy(VarList.begin(), VarList.end(),
113+
getTrailingObjects<Expr *>());
114+
}
115+
95116
OpenACCSelfClause::OpenACCSelfClause(SourceLocation BeginLoc,
96117
SourceLocation LParenLoc,
97118
Expr *ConditionExpr, SourceLocation EndLoc)
98-
: OpenACCClauseWithCondition(OpenACCClauseKind::Self, BeginLoc, LParenLoc,
99-
ConditionExpr, EndLoc) {
119+
: OpenACCClauseWithParams(OpenACCClauseKind::Self, BeginLoc, LParenLoc,
120+
EndLoc),
121+
HasConditionExpr(ConditionExpr != nullptr), NumExprs(1) {
100122
assert((!ConditionExpr || ConditionExpr->isInstantiationDependent() ||
101123
ConditionExpr->getType()->isScalarType()) &&
102124
"Condition expression type not scalar/dependent");
125+
std::uninitialized_copy(&ConditionExpr, &ConditionExpr + 1,
126+
getTrailingObjects<Expr *>());
103127
}
104128

105129
OpenACCClause::child_range OpenACCClause::children() {
@@ -555,9 +579,17 @@ void OpenACCClausePrinter::VisitIfClause(const OpenACCIfClause &C) {
555579

556580
void OpenACCClausePrinter::VisitSelfClause(const OpenACCSelfClause &C) {
557581
OS << "self";
558-
if (const Expr *CondExpr = C.getConditionExpr()) {
582+
583+
if (C.isConditionExprClause()) {
584+
if (const Expr *CondExpr = C.getConditionExpr()) {
585+
OS << "(";
586+
printExpr(CondExpr);
587+
OS << ")";
588+
}
589+
} else {
559590
OS << "(";
560-
printExpr(CondExpr);
591+
llvm::interleaveComma(C.getVarList(), OS,
592+
[&](const Expr *E) { printExpr(E); });
561593
OS << ")";
562594
}
563595
}

clang/lib/AST/StmtProfile.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,8 +2555,13 @@ void OpenACCClauseProfiler::VisitCreateClause(
25552555
}
25562556

25572557
void OpenACCClauseProfiler::VisitSelfClause(const OpenACCSelfClause &Clause) {
2558-
if (Clause.hasConditionExpr())
2559-
Profiler.VisitStmt(Clause.getConditionExpr());
2558+
if (Clause.isConditionExprClause()) {
2559+
if (Clause.hasConditionExpr())
2560+
Profiler.VisitStmt(Clause.getConditionExpr());
2561+
} else {
2562+
for (auto *E : Clause.getVarList())
2563+
Profiler.VisitStmt(E);
2564+
}
25602565
}
25612566

25622567
void OpenACCClauseProfiler::VisitFinalizeClause(

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ AArch64TargetInfo::getVScaleRange(const LangOptions &LangOpts) const {
714714
return std::nullopt;
715715
}
716716

717-
unsigned AArch64TargetInfo::getFMVPriority(ArrayRef<StringRef> Features) const {
717+
uint64_t AArch64TargetInfo::getFMVPriority(ArrayRef<StringRef> Features) const {
718718
return llvm::AArch64::getFMVPriority(Features);
719719
}
720720

clang/lib/Basic/Targets/AArch64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
137137
void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
138138
bool setCPU(const std::string &Name) override;
139139

140-
unsigned getFMVPriority(ArrayRef<StringRef> Features) const override;
140+
uint64_t getFMVPriority(ArrayRef<StringRef> Features) const override;
141141

142142
bool useFP16ConversionIntrinsics() const override {
143143
return false;

0 commit comments

Comments
 (0)