Skip to content

Commit 088e89c

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:8a237ab7d9022d24441544ba25be480f0c944f5a into amd-gfx:b8647b557932
Local branch amd-gfx b8647b5 Merged main:c3a1eb6207d85cb37ea29306481b40c9f6402309 into amd-gfx:65bf2a59b1c7 Remote branch main 8a237ab [TSan] Avoid use of ReplaceInstWithInst()
2 parents b8647b5 + 8a237ab commit 088e89c

File tree

40 files changed

+585
-129
lines changed

40 files changed

+585
-129
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function compute-projects-to-test() {
6868
done
6969
;;
7070
clang)
71-
for p in clang-tools-extra compiler-rt flang libc lldb openmp cross-project-tests; do
71+
for p in clang-tools-extra compiler-rt flang lldb cross-project-tests; do
7272
echo $p
7373
done
7474
;;
@@ -224,7 +224,7 @@ fi
224224
# needs while letting them run on the infrastructure provided by LLVM.
225225

226226
# Figure out which projects need to be built on each platform
227-
all_projects="bolt clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
227+
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
228228
modified_projects="$(keep-modified-projects ${all_projects})"
229229

230230
linux_projects_to_test=$(exclude-linux $(compute-projects-to-test ${modified_projects}))

clang/lib/AST/Interp/InterpBuiltin.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,9 @@ static bool interp__builtin_eh_return_data_regno(InterpState &S, CodePtr OpPC,
606606
return true;
607607
}
608608

609-
static bool interp__builtin_launder(InterpState &S, CodePtr OpPC,
610-
const InterpFrame *Frame,
611-
const Function *Func,
612-
const CallExpr *Call) {
609+
/// Just takes the first Argument to the call and puts it on the stack.
610+
static bool noopPointer(InterpState &S, CodePtr OpPC, const InterpFrame *Frame,
611+
const Function *Func, const CallExpr *Call) {
613612
const Pointer &Arg = S.Stk.peek<Pointer>();
614613
S.Stk.push<Pointer>(Arg);
615614
return true;
@@ -1144,7 +1143,9 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
11441143
break;
11451144

11461145
case Builtin::BI__builtin_launder:
1147-
if (!interp__builtin_launder(S, OpPC, Frame, F, Call))
1146+
case Builtin::BI__builtin___CFStringMakeConstantString:
1147+
case Builtin::BI__builtin___NSStringMakeConstantString:
1148+
if (!noopPointer(S, OpPC, Frame, F, Call))
11481149
return false;
11491150
break;
11501151

clang/test/AST/Interp/builtin-functions.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,3 +510,12 @@ namespace bswap {
510510
int h4 = __builtin_bswap32(0x1234) == 0x34120000 ? 1 : f();
511511
int h5 = __builtin_bswap64(0x1234) == 0x3412000000000000 ? 1 : f();
512512
}
513+
514+
#define CFSTR __builtin___CFStringMakeConstantString
515+
void test7(void) {
516+
const void *X;
517+
X = CFSTR("\242"); // both-warning {{input conversion stopped}}
518+
X = CFSTR("\0"); // no-warning
519+
X = CFSTR(242); // both-error {{cannot initialize a parameter of type 'const char *' with an rvalue of type 'int'}}
520+
X = CFSTR("foo", "bar"); // both-error {{too many arguments to function call}}
521+
}

libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.access/get_tzdb.pass.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916

2017
// const tzdb& get_tzdb();
@@ -30,8 +27,6 @@ int main(int, const char**) {
3027

3128
assert(!db.version.empty());
3229

33-
LIBCPP_ASSERT(!db.__rules.empty());
34-
3530
assert(!db.zones.empty());
3631
assert(std::ranges::is_sorted(db.zones));
3732
assert(std::ranges::adjacent_find(db.zones) == db.zones.end()); // is unique?

libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.access/get_tzdb_list.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916

2017
// const tzdb& get_tzdb_list();

libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.list/front.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916
//
2017
// class tzdb_list;

libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.list/iterators.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916
//
2017
// class tzdb_list;

libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.remote/reload_tzdb.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916

2017
// Note there is no Standard way to change the remote database used.

libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.remote/remote_version.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916

2017
// const string remote_version();

libcxx/test/std/time/time.zone/time.zone.link/time.zone.link.members/name.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916

2017
// class time_zone_link;

libcxx/test/std/time/time.zone/time.zone.link/time.zone.link.members/target.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916

2017
// class time_zone_link;

libcxx/test/std/time/time.zone/time.zone.link/time.zone.link.nonmembers/comparison.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916

2017
// bool operator==(const time_zone_link& x, const time_zone_link& y) noexcept;

libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/name.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916

2017
// class time_zone;

libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.nonmembers/comparison.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
// XFAIL: libcpp-has-no-incomplete-tzdb
1313
// XFAIL: availability-tzdb-missing
1414

15-
// TODO TZDB (#81654) Enable tests
16-
// UNSUPPORTED: c++20, c++23, c++26
17-
1815
// <chrono>
1916

2017
// bool operator==(const time_zone& x, const time_zone& y) noexcept;

llvm/include/llvm/CodeGenTypes/LowLevelType.h

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ class LLT {
4545
/*AddressSpace=*/0};
4646
}
4747

48+
/// Get a low-level token; just a scalar with zero bits (or no size).
49+
static constexpr LLT token() {
50+
return LLT{/*isPointer=*/false, /*isVector=*/false,
51+
/*isScalar=*/true, ElementCount::getFixed(0),
52+
/*SizeInBits=*/0,
53+
/*AddressSpace=*/0};
54+
}
55+
4856
/// Get a low-level pointer in the given address space.
4957
static constexpr LLT pointer(unsigned AddressSpace, unsigned SizeInBits) {
5058
assert(SizeInBits > 0 && "invalid pointer size");
@@ -134,17 +142,17 @@ class LLT {
134142

135143
explicit LLT(MVT VT);
136144

137-
constexpr bool isValid() const { return IsScalar || IsPointer || IsVector; }
138-
145+
constexpr bool isValid() const { return IsScalar || RawData != 0; }
139146
constexpr bool isScalar() const { return IsScalar; }
140-
141-
constexpr bool isPointer() const { return IsPointer && !IsVector; }
142-
143-
constexpr bool isPointerVector() const { return IsPointer && IsVector; }
144-
145-
constexpr bool isPointerOrPointerVector() const { return IsPointer; }
146-
147-
constexpr bool isVector() const { return IsVector; }
147+
constexpr bool isToken() const { return IsScalar && RawData == 0; };
148+
constexpr bool isVector() const { return isValid() && IsVector; }
149+
constexpr bool isPointer() const {
150+
return isValid() && IsPointer && !IsVector;
151+
}
152+
constexpr bool isPointerVector() const { return IsPointer && isVector(); }
153+
constexpr bool isPointerOrPointerVector() const {
154+
return IsPointer && isValid();
155+
}
148156

149157
/// Returns the number of elements in a vector LLT. Must only be called on
150158
/// vector types.
@@ -314,6 +322,28 @@ class LLT {
314322
/// described in static const *Field variables. Each of these variables
315323
/// is a 2-element array, with the first element describing the bitfield size
316324
/// and the second element describing the bitfield offset.
325+
///
326+
/// +--------+---------+--------+----------+----------------------+
327+
/// |isScalar|isPointer|isVector| RawData |Notes |
328+
/// +--------+---------+--------+----------+----------------------+
329+
/// | 0 | 0 | 0 | 0 |Invalid |
330+
/// +--------+---------+--------+----------+----------------------+
331+
/// | 0 | 0 | 1 | 0 |Tombstone Key |
332+
/// +--------+---------+--------+----------+----------------------+
333+
/// | 0 | 1 | 0 | 0 |Empty Key |
334+
/// +--------+---------+--------+----------+----------------------+
335+
/// | 1 | 0 | 0 | 0 |Token |
336+
/// +--------+---------+--------+----------+----------------------+
337+
/// | 1 | 0 | 0 | non-zero |Scalar |
338+
/// +--------+---------+--------+----------+----------------------+
339+
/// | 0 | 1 | 0 | non-zero |Pointer |
340+
/// +--------+---------+--------+----------+----------------------+
341+
/// | 0 | 0 | 1 | non-zero |Vector of non-pointer |
342+
/// +--------+---------+--------+----------+----------------------+
343+
/// | 0 | 1 | 1 | non-zero |Vector of pointer |
344+
/// +--------+---------+--------+----------+----------------------+
345+
///
346+
/// Everything else is reserved.
317347
typedef int BitFieldInfo[2];
318348
///
319349
/// This is how the bitfields are packed per Kind:

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 492775
19+
#define LLVM_MAIN_REVISION 492790
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/include/llvm/Object/ELFObjectFile.h

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -389,25 +389,35 @@ template <class ELFT> class ELFObjectFile : public ELFObjectFileBase {
389389
}
390390

391391
Error getBuildAttributes(ELFAttributeParser &Attributes) const override {
392+
uint32_t Type;
393+
switch (getEMachine()) {
394+
case ELF::EM_ARM:
395+
Type = ELF::SHT_ARM_ATTRIBUTES;
396+
break;
397+
case ELF::EM_RISCV:
398+
Type = ELF::SHT_RISCV_ATTRIBUTES;
399+
break;
400+
default:
401+
return Error::success();
402+
}
403+
392404
auto SectionsOrErr = EF.sections();
393405
if (!SectionsOrErr)
394406
return SectionsOrErr.takeError();
395-
396407
for (const Elf_Shdr &Sec : *SectionsOrErr) {
397-
if (Sec.sh_type == ELF::SHT_ARM_ATTRIBUTES ||
398-
Sec.sh_type == ELF::SHT_RISCV_ATTRIBUTES) {
399-
auto ErrorOrContents = EF.getSectionContents(Sec);
400-
if (!ErrorOrContents)
401-
return ErrorOrContents.takeError();
402-
403-
auto Contents = ErrorOrContents.get();
404-
if (Contents[0] != ELFAttrs::Format_Version || Contents.size() == 1)
405-
return Error::success();
406-
407-
if (Error E = Attributes.parse(Contents, ELFT::TargetEndianness))
408-
return E;
409-
break;
410-
}
408+
if (Sec.sh_type != Type)
409+
continue;
410+
auto ErrorOrContents = EF.getSectionContents(Sec);
411+
if (!ErrorOrContents)
412+
return ErrorOrContents.takeError();
413+
414+
auto Contents = ErrorOrContents.get();
415+
if (Contents[0] != ELFAttrs::Format_Version || Contents.size() == 1)
416+
return Error::success();
417+
418+
if (Error E = Attributes.parse(Contents, ELFT::TargetEndianness))
419+
return E;
420+
break;
411421
}
412422
return Error::success();
413423
}

llvm/lib/CodeGen/LowLevelTypeUtils.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ LLT llvm::getLLTForType(Type &Ty, const DataLayout &DL) {
3939
return LLT::scalar(SizeInBits);
4040
}
4141

42+
if (Ty.isTokenTy())
43+
return LLT::token();
44+
4245
return LLT();
4346
}
4447

llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,16 @@ class WaitcntGenerator {
485485
virtual AMDGPU::Waitcnt getAllZeroWaitcnt(bool IncludeVSCnt) const = 0;
486486

487487
virtual ~WaitcntGenerator() = default;
488+
489+
// Create a mask value from the initializer list of wait event types.
490+
static constexpr unsigned
491+
eventMask(std::initializer_list<WaitEventType> Events) {
492+
unsigned Mask = 0;
493+
for (auto &E : Events)
494+
Mask |= 1 << E;
495+
496+
return Mask;
497+
}
488498
};
489499

490500
class WaitcntGeneratorPreGFX12 : public WaitcntGenerator {
@@ -506,14 +516,12 @@ class WaitcntGeneratorPreGFX12 : public WaitcntGenerator {
506516
assert(ST);
507517

508518
static const unsigned WaitEventMaskForInstPreGFX12[NUM_INST_CNTS] = {
509-
(1 << VMEM_ACCESS) | (1 << VMEM_READ_ACCESS) |
510-
(1 << VMEM_SAMPLER_READ_ACCESS) | (1 << VMEM_BVH_READ_ACCESS),
511-
(1 << SMEM_ACCESS) | (1 << LDS_ACCESS) | (1 << GDS_ACCESS) |
512-
(1 << SQ_MESSAGE),
513-
(1 << EXP_GPR_LOCK) | (1 << GDS_GPR_LOCK) | (1 << VMW_GPR_LOCK) |
514-
(1 << EXP_PARAM_ACCESS) | (1 << EXP_POS_ACCESS) |
515-
(1 << EXP_LDS_ACCESS),
516-
(1 << VMEM_WRITE_ACCESS) | (1 << SCRATCH_WRITE_ACCESS),
519+
eventMask({VMEM_ACCESS, VMEM_READ_ACCESS, VMEM_SAMPLER_READ_ACCESS,
520+
VMEM_BVH_READ_ACCESS}),
521+
eventMask({SMEM_ACCESS, LDS_ACCESS, GDS_ACCESS, SQ_MESSAGE}),
522+
eventMask({EXP_GPR_LOCK, GDS_GPR_LOCK, VMW_GPR_LOCK, EXP_PARAM_ACCESS,
523+
EXP_POS_ACCESS, EXP_LDS_ACCESS}),
524+
eventMask({VMEM_WRITE_ACCESS, SCRATCH_WRITE_ACCESS}),
517525
0,
518526
0,
519527
0};
@@ -543,15 +551,14 @@ class WaitcntGeneratorGFX12Plus : public WaitcntGenerator {
543551
assert(ST);
544552

545553
static const unsigned WaitEventMaskForInstGFX12Plus[NUM_INST_CNTS] = {
546-
(1 << VMEM_ACCESS) | (1 << VMEM_READ_ACCESS),
547-
(1 << LDS_ACCESS) | (1 << GDS_ACCESS),
548-
(1 << EXP_GPR_LOCK) | (1 << GDS_GPR_LOCK) | (1 << VMW_GPR_LOCK) |
549-
(1 << EXP_PARAM_ACCESS) | (1 << EXP_POS_ACCESS) |
550-
(1 << EXP_LDS_ACCESS),
551-
(1 << VMEM_WRITE_ACCESS) | (1 << SCRATCH_WRITE_ACCESS),
552-
(1 << VMEM_SAMPLER_READ_ACCESS),
553-
(1 << VMEM_BVH_READ_ACCESS),
554-
(1 << SMEM_ACCESS) | (1 << SQ_MESSAGE)};
554+
eventMask({VMEM_ACCESS, VMEM_READ_ACCESS}),
555+
eventMask({LDS_ACCESS, GDS_ACCESS}),
556+
eventMask({EXP_GPR_LOCK, GDS_GPR_LOCK, VMW_GPR_LOCK, EXP_PARAM_ACCESS,
557+
EXP_POS_ACCESS, EXP_LDS_ACCESS}),
558+
eventMask({VMEM_WRITE_ACCESS, SCRATCH_WRITE_ACCESS}),
559+
eventMask({VMEM_SAMPLER_READ_ACCESS}),
560+
eventMask({VMEM_BVH_READ_ACCESS}),
561+
eventMask({SMEM_ACCESS, SQ_MESSAGE})};
555562

556563
return WaitEventMaskForInstGFX12Plus;
557564
}

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6100,6 +6100,9 @@ NVPTXTargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const {
61006100

61016101
if (AI->isFloatingPointOperation()) {
61026102
if (AI->getOperation() == AtomicRMWInst::BinOp::FAdd) {
6103+
if (Ty->isHalfTy() && STI.getSmVersion() >= 70 &&
6104+
STI.getPTXVersion() >= 63)
6105+
return AtomicExpansionKind::None;
61036106
if (Ty->isFloatTy())
61046107
return AtomicExpansionKind::None;
61056108
if (Ty->isDoubleTy() && STI.hasAtomAddF64())

0 commit comments

Comments
 (0)