Skip to content

Commit 8866630

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#2246)
2 parents 74d7e99 + 0405c2e commit 8866630

File tree

135 files changed

+2419
-1326
lines changed

Some content is hidden

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

135 files changed

+2419
-1326
lines changed

clang/include/clang/AST/DeclFriend.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ class FriendDecl final
9090
: Decl(Decl::Friend, DC, L), Friend(Friend), FriendLoc(FriendL),
9191
EllipsisLoc(EllipsisLoc), UnsupportedFriend(false),
9292
NumTPLists(FriendTypeTPLists.size()) {
93-
for (unsigned i = 0; i < NumTPLists; ++i)
94-
getTrailingObjects<TemplateParameterList *>()[i] = FriendTypeTPLists[i];
93+
llvm::copy(FriendTypeTPLists, getTrailingObjects());
9594
}
9695

9796
FriendDecl(EmptyShell Empty, unsigned NumFriendTypeTPLists)
@@ -132,8 +131,7 @@ class FriendDecl final
132131
}
133132

134133
TemplateParameterList *getFriendTypeTemplateParameterList(unsigned N) const {
135-
assert(N < NumTPLists);
136-
return getTrailingObjects<TemplateParameterList *>()[N];
134+
return getTrailingObjects(NumTPLists)[N];
137135
}
138136

139137
/// If this friend declaration doesn't name a type, return the inner
@@ -153,10 +151,9 @@ class FriendDecl final
153151
/// Retrieves the source range for the friend declaration.
154152
SourceRange getSourceRange() const override LLVM_READONLY {
155153
if (TypeSourceInfo *TInfo = getFriendType()) {
156-
SourceLocation StartL =
157-
(NumTPLists == 0) ? getFriendLoc()
158-
: getTrailingObjects<TemplateParameterList *>()[0]
159-
->getTemplateLoc();
154+
SourceLocation StartL = (NumTPLists == 0)
155+
? getFriendLoc()
156+
: getTrailingObjects()[0]->getTemplateLoc();
160157
SourceLocation EndL = isPackExpansion() ? getEllipsisLoc()
161158
: TInfo->getTypeLoc().getEndLoc();
162159
return SourceRange(StartL, EndL);

clang/include/clang/AST/DeclGroup.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,10 @@ class DeclGroup final : private llvm::TrailingObjects<DeclGroup, Decl *> {
3737

3838
unsigned size() const { return NumDecls; }
3939

40-
Decl*& operator[](unsigned i) {
41-
assert (i < NumDecls && "Out-of-bounds access.");
42-
return getTrailingObjects<Decl *>()[i];
43-
}
40+
Decl *&operator[](unsigned i) { return getTrailingObjects(NumDecls)[i]; }
4441

4542
Decl* const& operator[](unsigned i) const {
46-
assert (i < NumDecls && "Out-of-bounds access.");
47-
return getTrailingObjects<Decl *>()[i];
43+
return getTrailingObjects(NumDecls)[i];
4844
}
4945
};
5046

clang/include/clang/AST/DeclObjC.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ class ObjCTypeParamList final
678678
/// Iterate through the type parameters in the list.
679679
using iterator = ObjCTypeParamDecl **;
680680

681-
iterator begin() { return getTrailingObjects<ObjCTypeParamDecl *>(); }
681+
iterator begin() { return getTrailingObjects(); }
682682

683683
iterator end() { return begin() + size(); }
684684

@@ -688,9 +688,7 @@ class ObjCTypeParamList final
688688
// Iterate through the type parameters in the list.
689689
using const_iterator = ObjCTypeParamDecl * const *;
690690

691-
const_iterator begin() const {
692-
return getTrailingObjects<ObjCTypeParamDecl *>();
693-
}
691+
const_iterator begin() const { return getTrailingObjects(); }
694692

695693
const_iterator end() const {
696694
return begin() + size();

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ TARGET_BUILTIN(__builtin_amdgcn_flat_atomic_fadd_v2bf16, "V2sV2s*0V2s", "t", "at
257257
TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_v2bf16, "V2sV2s*1V2s", "t", "atomic-global-pk-add-bf16-inst")
258258
TARGET_BUILTIN(__builtin_amdgcn_ds_atomic_fadd_v2bf16, "V2sV2s*3V2s", "t", "atomic-ds-pk-add-16-insts")
259259
TARGET_BUILTIN(__builtin_amdgcn_ds_atomic_fadd_v2f16, "V2hV2h*3V2h", "t", "atomic-ds-pk-add-16-insts")
260+
TARGET_BUILTIN(__builtin_amdgcn_load_to_lds, "vv*v*3IUiIiIUi", "t", "vmem-to-lds-load-insts")
260261
TARGET_BUILTIN(__builtin_amdgcn_global_load_lds, "vv*1v*3IUiIiIUi", "t", "vmem-to-lds-load-insts")
261262

262263
//===----------------------------------------------------------------------===//

clang/lib/APINotes/APINotesReader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,8 +2048,8 @@ APINotesReader::VersionedInfo<T>::VersionedInfo(
20482048
: Results(std::move(R)) {
20492049

20502050
assert(!Results.empty());
2051-
assert(std::is_sorted(
2052-
Results.begin(), Results.end(),
2051+
assert(llvm::is_sorted(
2052+
Results,
20532053
[](const std::pair<llvm::VersionTuple, T> &left,
20542054
const std::pair<llvm::VersionTuple, T> &right) -> bool {
20552055
// The comparison function should be reflective, and with expensive

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2922,32 +2922,22 @@ bool Compiler<Emitter>::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) {
29222922
if (T && !E->isLValue()) {
29232923
// For primitive types, we just visit the initializer.
29242924
return this->delegate(Init);
2925-
} else {
2926-
unsigned LocalIndex;
2927-
2928-
if (T)
2929-
LocalIndex = this->allocateLocalPrimitive(Init, *T, /*IsConst=*/false);
2930-
else if (std::optional<unsigned> MaybeIndex = this->allocateLocal(Init))
2931-
LocalIndex = *MaybeIndex;
2932-
else
2933-
return false;
2925+
}
29342926

2935-
if (!this->emitGetPtrLocal(LocalIndex, E))
2936-
return false;
2927+
unsigned LocalIndex;
2928+
if (T)
2929+
LocalIndex = this->allocateLocalPrimitive(Init, *T, /*IsConst=*/false);
2930+
else if (std::optional<unsigned> MaybeIndex = this->allocateLocal(Init))
2931+
LocalIndex = *MaybeIndex;
2932+
else
2933+
return false;
29372934

2938-
if (T) {
2939-
if (!this->visit(Init)) {
2940-
return false;
2941-
}
2942-
return this->emitInit(*T, E);
2943-
} else {
2944-
if (!this->visitInitializer(Init) || !this->emitFinishInit(E))
2945-
return false;
2946-
}
2947-
return true;
2948-
}
2935+
if (!this->emitGetPtrLocal(LocalIndex, E))
2936+
return false;
29492937

2950-
return false;
2938+
if (T)
2939+
return this->visit(Init) && this->emitInit(*T, E);
2940+
return this->visitInitializer(Init) && this->emitFinishInit(E);
29512941
}
29522942

29532943
template <class Emitter>

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,21 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
851851
if (F->isLambdaStaticInvoker())
852852
return true;
853853

854+
// Diagnose failed assertions specially.
855+
if (S.Current->getLocation(OpPC).isMacroID() &&
856+
F->getDecl()->getIdentifier()) {
857+
// FIXME: Instead of checking for an implementation-defined function,
858+
// check and evaluate the assert() macro.
859+
StringRef Name = F->getDecl()->getName();
860+
bool AssertFailed =
861+
Name == "__assert_rtn" || Name == "__assert_fail" || Name == "_wassert";
862+
if (AssertFailed) {
863+
S.FFDiag(S.Current->getLocation(OpPC),
864+
diag::note_constexpr_assert_failed);
865+
return false;
866+
}
867+
}
868+
854869
if (S.getLangOpts().CPlusPlus11) {
855870
const FunctionDecl *DiagDecl = F->getDecl();
856871

clang/lib/AST/DeclBase.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,8 +1924,7 @@ DeclContext::lookupImpl(DeclarationName Name,
19241924
Map = CreateStoredDeclsMap(getParentASTContext());
19251925

19261926
// If we have a lookup result with no external decls, we are done.
1927-
std::pair<StoredDeclsMap::iterator, bool> R =
1928-
Map->insert(std::make_pair(Name, StoredDeclsList()));
1927+
std::pair<StoredDeclsMap::iterator, bool> R = Map->try_emplace(Name);
19291928
if (!R.second && !R.first->second.hasExternalDecls())
19301929
return R.first->second.getLookupResult();
19311930

clang/lib/AST/DeclGroup.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,5 @@ DeclGroup* DeclGroup::Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
2828
DeclGroup::DeclGroup(unsigned numdecls, Decl** decls) : NumDecls(numdecls) {
2929
assert(numdecls > 0);
3030
assert(decls);
31-
std::uninitialized_copy(decls, decls + numdecls,
32-
getTrailingObjects<Decl *>());
31+
std::uninitialized_copy(decls, decls + numdecls, getTrailingObjects());
3332
}

clang/lib/AST/Type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5589,7 +5589,7 @@ LLVM_DUMP_METHOD void FunctionEffectKindSet::dump(llvm::raw_ostream &OS) const {
55895589
FunctionEffectsRef
55905590
FunctionEffectsRef::create(ArrayRef<FunctionEffect> FX,
55915591
ArrayRef<EffectConditionExpr> Conds) {
5592-
assert(std::is_sorted(FX.begin(), FX.end()) && "effects should be sorted");
5592+
assert(llvm::is_sorted(FX) && "effects should be sorted");
55935593
assert((Conds.empty() || Conds.size() == FX.size()) &&
55945594
"effects size should match conditions size");
55955595
return FunctionEffectsRef(FX, Conds);

0 commit comments

Comments
 (0)