Skip to content

Commit 99af3f5

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-resumephi-vpinst-for-reductions
2 parents 3852344 + 9648271 commit 99af3f5

File tree

115 files changed

+2219
-576
lines changed

Some content is hidden

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

115 files changed

+2219
-576
lines changed

clang-tools-extra/modularize/CoverageChecker.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,9 @@ bool CoverageChecker::collectModuleHeaders(const Module &Mod) {
223223
return false;
224224
}
225225

226-
for (auto &HeaderKind : Mod.Headers)
227-
for (auto &Header : HeaderKind)
228-
ModuleMapHeadersSet.insert(
229-
ModularizeUtilities::getCanonicalPath(Header.Entry.getName()));
226+
for (const auto &Header : Mod.getAllHeaders())
227+
ModuleMapHeadersSet.insert(
228+
ModularizeUtilities::getCanonicalPath(Header.Entry.getName()));
230229

231230
for (auto *Submodule : Mod.submodules())
232231
collectModuleHeaders(*Submodule);

clang-tools-extra/modularize/ModularizeUtilities.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ bool ModularizeUtilities::collectModuleHeaders(const clang::Module &Mod) {
358358
} else if (std::optional<clang::Module::DirectoryName> UmbrellaDir =
359359
Mod.getUmbrellaDirAsWritten()) {
360360
// If there normal headers, assume these are umbrellas and skip collection.
361-
if (Mod.Headers->size() == 0) {
361+
if (Mod.getHeaders(Module::HK_Normal).empty()) {
362362
// Collect headers in umbrella directory.
363363
if (!collectUmbrellaHeaders(UmbrellaDir->Entry.getName(),
364364
UmbrellaDependents))
@@ -371,16 +371,8 @@ bool ModularizeUtilities::collectModuleHeaders(const clang::Module &Mod) {
371371
// modules or because they are meant to be included by another header,
372372
// and thus should be ignored by modularize.
373373

374-
int NormalHeaderCount = Mod.Headers[clang::Module::HK_Normal].size();
375-
376-
for (int Index = 0; Index < NormalHeaderCount; ++Index) {
377-
DependentsVector NormalDependents;
378-
// Collect normal header.
379-
const clang::Module::Header &Header(
380-
Mod.Headers[clang::Module::HK_Normal][Index]);
381-
std::string HeaderPath = getCanonicalPath(Header.Entry.getName());
382-
HeaderFileNames.push_back(HeaderPath);
383-
}
374+
for (const auto &Header : Mod.getHeaders(clang::Module::HK_Normal))
375+
HeaderFileNames.push_back(getCanonicalPath(Header.Entry.getName()));
384376

385377
int MissingCountThisModule = Mod.MissingHeaders.size();
386378

clang/docs/ReleaseNotes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ C++ Specific Potentially Breaking Changes
133133
// Fixed version:
134134
unsigned operator""_udl_name(unsigned long long);
135135

136+
- Clang will now produce an error diagnostic when [[clang::lifetimebound]] is
137+
applied on a parameter of a function that returns void. This was previously
138+
ignored and had no effect. (#GH107556)
139+
140+
.. code-block:: c++
141+
142+
// Now diagnoses with an error.
143+
void f(int& i [[clang::lifetimebound]]);
144+
136145
ABI Changes in This Version
137146
---------------------------
138147

clang/include/clang/Basic/AMDGPUTypes.def

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@
1515
AMDGPU_TYPE(Name, Id, SingletonId, Width, Align)
1616
#endif
1717

18+
#ifndef AMDGPU_NAMED_BARRIER_TYPE
19+
#define AMDGPU_NAMED_BARRIER_TYPE(Name, Id, SingletonId, Width, Align, Scope) \
20+
AMDGPU_TYPE(Name, Id, SingletonId, Width, Align)
21+
#endif
22+
1823
AMDGPU_OPAQUE_PTR_TYPE("__amdgpu_buffer_rsrc_t", AMDGPUBufferRsrc, AMDGPUBufferRsrcTy, 128, 128, 8)
1924

25+
AMDGPU_NAMED_BARRIER_TYPE("__amdgpu_named_workgroup_barrier_t", AMDGPUNamedWorkgroupBarrier, AMDGPUNamedWorkgroupBarrierTy, 128, 32, 0)
26+
2027
#undef AMDGPU_TYPE
2128
#undef AMDGPU_OPAQUE_PTR_TYPE
29+
#undef AMDGPU_NAMED_BARRIER_TYPE

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10097,6 +10097,9 @@ def err_lifetimebound_no_object_param : Error<
1009710097
def err_lifetimebound_ctor_dtor : Error<
1009810098
"'lifetimebound' attribute cannot be applied to a "
1009910099
"%select{constructor|destructor}0">;
10100+
def err_lifetimebound_void_return_type : Error<
10101+
"'lifetimebound' attribute cannot be applied to a parameter of a function "
10102+
"that returns void">;
1010010103

1010110104
// CHECK: returning address/reference of stack memory
1010210105
def warn_ret_stack_addr_ref : Warning<

clang/include/clang/Basic/Module.h

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,6 @@ class alignas(8) Module {
253253
HK_PrivateTextual,
254254
HK_Excluded
255255
};
256-
static const int NumHeaderKinds = HK_Excluded + 1;
257-
258256
/// Information about a header directive as found in the module map
259257
/// file.
260258
struct Header {
@@ -263,17 +261,36 @@ class alignas(8) Module {
263261
FileEntryRef Entry;
264262
};
265263

266-
/// Information about a directory name as found in the module map
267-
/// file.
264+
private:
265+
static const int NumHeaderKinds = HK_Excluded + 1;
266+
// The begin index for a HeaderKind also acts the end index of HeaderKind - 1.
267+
// The extra element at the end acts as the end index of the last HeaderKind.
268+
unsigned HeaderKindBeginIndex[NumHeaderKinds + 1] = {};
269+
SmallVector<Header, 2> HeadersStorage;
270+
271+
public:
272+
ArrayRef<Header> getAllHeaders() const { return HeadersStorage; }
273+
ArrayRef<Header> getHeaders(HeaderKind HK) const {
274+
assert(HK < NumHeaderKinds && "Invalid Module::HeaderKind");
275+
auto BeginIt = HeadersStorage.begin() + HeaderKindBeginIndex[HK];
276+
auto EndIt = HeadersStorage.begin() + HeaderKindBeginIndex[HK + 1];
277+
return {BeginIt, EndIt};
278+
}
279+
void addHeader(HeaderKind HK, Header H) {
280+
assert(HK < NumHeaderKinds && "Invalid Module::HeaderKind");
281+
auto EndIt = HeadersStorage.begin() + HeaderKindBeginIndex[HK + 1];
282+
HeadersStorage.insert(EndIt, std::move(H));
283+
for (unsigned HKI = HK + 1; HKI != NumHeaderKinds + 1; ++HKI)
284+
++HeaderKindBeginIndex[HKI];
285+
}
286+
287+
/// Information about a directory name as found in the module map file.
268288
struct DirectoryName {
269289
std::string NameAsWritten;
270290
std::string PathRelativeToRootModuleDirectory;
271291
DirectoryEntryRef Entry;
272292
};
273293

274-
/// The headers that are part of this module.
275-
SmallVector<Header, 2> Headers[5];
276-
277294
/// Stored information about a header directive that was found in the
278295
/// module map file but has not been resolved to a file.
279296
struct UnresolvedHeaderDirective {

clang/lib/Basic/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ void Module::print(raw_ostream &OS, unsigned Indent, bool Dump) const {
528528

529529
for (auto &K : Kinds) {
530530
assert(&K == &Kinds[K.Kind] && "kinds in wrong order");
531-
for (auto &H : Headers[K.Kind]) {
531+
for (auto &H : getHeaders(K.Kind)) {
532532
OS.indent(Indent + 2);
533533
OS << K.Prefix << "header \"";
534534
OS.write_escaped(H.NameAsWritten);

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,13 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
916916
TheCU, TheCU->getFile(), 0); \
917917
return SingletonId; \
918918
}
919+
#define AMDGPU_NAMED_BARRIER_TYPE(Name, Id, SingletonId, Width, Align, Scope) \
920+
case BuiltinType::Id: { \
921+
if (!SingletonId) \
922+
SingletonId = \
923+
DBuilder.createBasicType(Name, Width, llvm::dwarf::DW_ATE_unsigned); \
924+
return SingletonId; \
925+
}
919926
#include "clang/Basic/AMDGPUTypes.def"
920927
case BuiltinType::UChar:
921928
case BuiltinType::Char_U:

clang/lib/CodeGen/CodeGenTypes.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,10 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
564564
#define AMDGPU_OPAQUE_PTR_TYPE(Name, Id, SingletonId, Width, Align, AS) \
565565
case BuiltinType::Id: \
566566
return llvm::PointerType::get(getLLVMContext(), AS);
567+
#define AMDGPU_NAMED_BARRIER_TYPE(Name, Id, SingletonId, Width, Align, Scope) \
568+
case BuiltinType::Id: \
569+
return llvm::TargetExtType::get(getLLVMContext(), "amdgcn.named.barrier", \
570+
{}, {Scope});
567571
#include "clang/Basic/AMDGPUTypes.def"
568572
#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
569573
#include "clang/Basic/HLSLIntangibleTypes.def"

clang/lib/Frontend/FrontendAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static std::error_code collectModuleHeaderIncludes(
358358

359359
// Add includes for each of these headers.
360360
for (auto HK : {Module::HK_Normal, Module::HK_Private}) {
361-
for (Module::Header &H : Module->Headers[HK]) {
361+
for (const Module::Header &H : Module->getHeaders(HK)) {
362362
Module->addTopHeader(H.Entry);
363363
// Use the path as specified in the module map file. We'll look for this
364364
// file relative to the module build directory (the directory containing

0 commit comments

Comments
 (0)