Skip to content

Commit ae3ea5c

Browse files
authored
merge main into amd-staging (llvm#2215)
2 parents 0f9da0f + ecbcd6b commit ae3ea5c

36 files changed

+483
-151
lines changed

clang/include/clang/Sema/Overload.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ class Sema;
435435

436436
// A function pointer type can be resolved to a member function type,
437437
// which is still an identity conversion.
438-
if (auto *N = T->getAs<MemberPointerType>())
438+
if (auto *N = T->getAs<MemberPointerType>();
439+
N && N->isMemberFunctionPointer())
439440
T = C.getDecayedType(N->getPointeeType());
440441
return T;
441442
};

clang/lib/Basic/Diagnostic.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -533,24 +533,25 @@ void WarningsSpecialCaseList::processSections(DiagnosticsEngine &Diags) {
533533
// Drop the default section introduced by special case list, we only support
534534
// exact diagnostic group names.
535535
// FIXME: We should make this configurable in the parser instead.
536-
Sections.erase("*");
536+
// FIXME: C++20 can use std::erase_if(Sections, [](Section &sec) { return
537+
// sec.SectionStr == "*"; });
538+
llvm::erase_if(Sections, [](Section &sec) { return sec.SectionStr == "*"; });
537539
// Make sure we iterate sections by their line numbers.
538-
std::vector<std::pair<unsigned, const llvm::StringMapEntry<Section> *>>
539-
LineAndSectionEntry;
540+
std::vector<std::pair<unsigned, const Section *>> LineAndSectionEntry;
540541
LineAndSectionEntry.reserve(Sections.size());
541542
for (const auto &Entry : Sections) {
542-
StringRef DiagName = Entry.getKey();
543+
StringRef DiagName = Entry.SectionStr;
543544
// Each section has a matcher with that section's name, attached to that
544545
// line.
545-
const auto &DiagSectionMatcher = Entry.getValue().SectionMatcher;
546+
const auto &DiagSectionMatcher = Entry.SectionMatcher;
546547
unsigned DiagLine = DiagSectionMatcher->Globs.at(DiagName).second;
547548
LineAndSectionEntry.emplace_back(DiagLine, &Entry);
548549
}
549550
llvm::sort(LineAndSectionEntry);
550551
static constexpr auto WarningFlavor = clang::diag::Flavor::WarningOrError;
551552
for (const auto &[_, SectionEntry] : LineAndSectionEntry) {
552553
SmallVector<diag::kind> GroupDiags;
553-
StringRef DiagGroup = SectionEntry->getKey();
554+
StringRef DiagGroup = SectionEntry->SectionStr;
554555
if (Diags.getDiagnosticIDs()->getDiagnosticsInGroup(
555556
WarningFlavor, DiagGroup, GroupDiags)) {
556557
StringRef Suggestion =
@@ -563,7 +564,7 @@ void WarningsSpecialCaseList::processSections(DiagnosticsEngine &Diags) {
563564
for (diag::kind Diag : GroupDiags)
564565
// We're intentionally overwriting any previous mappings here to make sure
565566
// latest one takes precedence.
566-
DiagToSection[Diag] = &SectionEntry->getValue();
567+
DiagToSection[Diag] = SectionEntry;
567568
}
568569
}
569570

clang/lib/Basic/ProfileList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ProfileSpecialCaseList : public llvm::SpecialCaseList {
3737

3838
bool hasPrefix(StringRef Prefix) const {
3939
for (const auto &It : Sections)
40-
if (It.second.Entries.count(Prefix) > 0)
40+
if (It.Entries.count(Prefix) > 0)
4141
return true;
4242
return false;
4343
}

clang/lib/Basic/SanitizerSpecialCaseList.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ SanitizerSpecialCaseList::createOrDie(const std::vector<std::string> &Paths,
3737
}
3838

3939
void SanitizerSpecialCaseList::createSanitizerSections() {
40-
for (auto &It : Sections) {
41-
auto &S = It.second;
40+
for (auto &S : Sections) {
4241
SanitizerMask Mask;
4342

4443
#define SANITIZER(NAME, ID) \

clang/test/SemaCXX/overload-resolution-deferred-templates.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,26 @@ void f() {
251251
e.g(&N::f);
252252
}
253253
}
254+
255+
#if __cplusplus >= 201402
256+
namespace PointerToMemData {
257+
struct N {
258+
int field;
259+
};
260+
template <typename It, typename T>
261+
struct B {
262+
B(It, T);
263+
template <typename It2>
264+
B(B<It2, T>);
265+
};
266+
template <typename T>
267+
struct C {
268+
auto g() { return B<int, T>(0, T{}); }
269+
};
270+
void f() {
271+
using T = decltype(C<decltype(&N::field)>{}.g());
272+
}
273+
274+
}
275+
276+
#endif

libc/config/linux/riscv/entrypoints.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ set(TARGET_LIBC_ENTRYPOINTS
370370
libc.src.sys.uio.readv
371371

372372
# sys/time.h entrypoints
373-
# libc.src.sys.time.setitimer
374-
# libc.src.sys.time.getitimer
373+
libc.src.sys.time.setitimer
374+
libc.src.sys.time.getitimer
375375
)
376376

377377
if(LLVM_LIBC_INCLUDE_SCUDO)

libc/src/sys/time/linux/getitimer.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,22 @@
1616
namespace LIBC_NAMESPACE_DECL {
1717

1818
LLVM_LIBC_FUNCTION(int, getitimer, (int which, struct itimerval *curr_value)) {
19-
long ret =
20-
LIBC_NAMESPACE::syscall_impl<long>(SYS_getitimer, which, curr_value);
19+
long ret = 0;
20+
if constexpr (sizeof(time_t) > sizeof(long)) {
21+
// There is no SYS_getitimer_time64 call, so we can't use time_t directly.
22+
long curr_value32[4];
23+
ret =
24+
LIBC_NAMESPACE::syscall_impl<long>(SYS_getitimer, which, curr_value32);
25+
if (!ret) {
26+
curr_value->it_interval.tv_sec = curr_value32[0];
27+
curr_value->it_interval.tv_usec = curr_value32[1];
28+
curr_value->it_value.tv_sec = curr_value32[2];
29+
curr_value->it_value.tv_usec = curr_value32[3];
30+
}
31+
} else {
32+
ret = LIBC_NAMESPACE::syscall_impl<long>(SYS_getitimer, which, curr_value);
33+
}
34+
2135
// On failure, return -1 and set errno.
2236
if (ret < 0) {
2337
libc_errno = static_cast<int>(-ret);

libc/src/sys/time/linux/setitimer.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,30 @@ namespace LIBC_NAMESPACE_DECL {
1717
LLVM_LIBC_FUNCTION(int, setitimer,
1818
(int which, const struct itimerval *new_value,
1919
struct itimerval *old_value)) {
20-
long ret = LIBC_NAMESPACE::syscall_impl<long>(SYS_setitimer, which, new_value,
21-
old_value);
20+
long ret = 0;
21+
if constexpr (sizeof(time_t) > sizeof(long)) {
22+
// There is no SYS_setitimer_time64 call, so we can't use time_t directly,
23+
// and need to convert it to long first.
24+
long new_value32[4] = {static_cast<long>(new_value->it_interval.tv_sec),
25+
new_value->it_interval.tv_usec,
26+
static_cast<long>(new_value->it_value.tv_sec),
27+
new_value->it_value.tv_usec};
28+
long old_value32[4];
29+
30+
ret = LIBC_NAMESPACE::syscall_impl<long>(SYS_setitimer, which, new_value32,
31+
old_value32);
32+
33+
if (!ret && old_value) {
34+
old_value->it_interval.tv_sec = old_value32[0];
35+
old_value->it_interval.tv_usec = old_value32[1];
36+
old_value->it_value.tv_sec = old_value32[2];
37+
old_value->it_value.tv_usec = old_value32[3];
38+
}
39+
} else {
40+
ret = LIBC_NAMESPACE::syscall_impl<long>(SYS_setitimer, which, new_value,
41+
old_value);
42+
}
43+
2244
// On failure, return -1 and set errno.
2345
if (ret < 0) {
2446
libc_errno = static_cast<int>(-ret);

llvm/docs/AMDGPUUsage.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ The AMDGPU backend implements the following LLVM IR intrinsics.
13531353

13541354
llvm.amdgcn.sched.group.barrier Creates schedule groups with specific properties to create custom scheduling
13551355
pipelines. The ordering between groups is enforced by the instruction scheduler.
1356-
The intrinsic applies to the code that preceeds the intrinsic. The intrinsic
1356+
The intrinsic applies to the code that precedes the intrinsic. The intrinsic
13571357
takes three values that control the behavior of the schedule groups.
13581358

13591359
- Mask : Classify instruction groups using the llvm.amdgcn.sched_barrier mask values.
@@ -1670,7 +1670,7 @@ The AMDGPU backend supports the following LLVM IR attributes.
16701670

16711671
"amdgpu-git-ptr-high" The hard-wired high half of the address of the global information table
16721672
for AMDPAL OS type. 0xffffffff represents no hard-wired high half, since
1673-
current hardware only allows a 16 bit value.
1673+
current hardware only allows a 16-bit value.
16741674

16751675
"amdgpu-32bit-address-high-bits" Assumed high 32-bits for 32-bit address spaces which are really truncated
16761676
64-bit addresses (i.e., addrspace(6))
@@ -4844,7 +4844,7 @@ apertures address can be used. For GFX7-GFX8 these are available in the
48444844
:ref:`amdgpu-amdhsa-hsa-aql-queue` the address of which can be obtained with
48454845
Queue Ptr SGPR (see :ref:`amdgpu-amdhsa-initial-kernel-execution-state`). For
48464846
GFX9-GFX11 the aperture base addresses are directly available as inline constant
4847-
registers ``SRC_SHARED_BASE/LIMIT`` and ``SRC_PRIVATE_BASE/LIMIT``. In 64 bit
4847+
registers ``SRC_SHARED_BASE/LIMIT`` and ``SRC_PRIVATE_BASE/LIMIT``. In 64-bit
48484848
address mode the aperture sizes are 2^32 bytes and the base is aligned to 2^32
48494849
which makes it easier to convert from flat to segment or segment to flat.
48504850

llvm/docs/CIBestPractices.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ just a release, which looks like the following:
6161
However, it is best practice to specify an exact commit SHA from which to pull
6262
the action from, noting the version in a comment:
6363

64-
We plan on revisting this reccomendation once Github's immutable actions have
64+
We plan on revisiting this recommendation once Github's immutable actions have
6565
been rolled out as GA.
6666

6767
.. code-block:: yaml

0 commit comments

Comments
 (0)