Skip to content

Commit 2485fb7

Browse files
committed
Merged main:ed1aabef1da1b074b71ad523978ea836d6e7d2e7 into amd-gfx:0f78e4fe65f0
Local branch amd-gfx 0f78e4f Merged main:b1d2e8510b58893e58558ffdf3f8ba29c1e25e5a into amd-gfx:2c00c57204cb Remote branch main ed1aabe remove expensive copy of options passed (llvm#82577) Change-Id: I30289c05819bc1401a67f4bd8c248b56c3819a11
2 parents 0f78e4f + ed1aabe commit 2485fb7

File tree

131 files changed

+4379
-2231
lines changed

Some content is hidden

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

131 files changed

+4379
-2231
lines changed

clang/lib/Basic/Targets/Mips.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,14 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
237237
case 'r': // CPU registers.
238238
case 'd': // Equivalent to "r" unless generating MIPS16 code.
239239
case 'y': // Equivalent to "r", backward compatibility only.
240-
case 'f': // floating-point registers.
241240
case 'c': // $25 for indirect jumps
242241
case 'l': // lo register
243242
case 'x': // hilo register pair
244243
Info.setAllowsRegister();
245244
return true;
245+
case 'f': // floating-point registers.
246+
Info.setAllowsRegister();
247+
return FloatABI != SoftFloat;
246248
case 'I': // Signed 16-bit constant
247249
case 'J': // Integer 0
248250
case 'K': // Unsigned 16-bit constant

clang/lib/Format/Format.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3923,7 +3923,7 @@ FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code) {
39233923
auto Extension = llvm::sys::path::extension(FileName);
39243924
// If there's no file extension (or it's .h), we need to check the contents
39253925
// of the code to see if it contains Objective-C.
3926-
if (Extension.empty() || Extension == ".h") {
3926+
if (!Code.empty() && (Extension.empty() || Extension == ".h")) {
39273927
auto NonEmptyFileName = FileName.empty() ? "guess.h" : FileName;
39283928
Environment Env(Code, NonEmptyFileName, /*Ranges=*/{});
39293929
ObjCHeaderStyleGuesser Guesser(Env, getLLVMStyle());
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %clang_cc1 -emit-llvm -triple mips -target-feature +soft-float %s -o - | FileCheck %s --check-prefix=SOFT_FLOAT
2+
3+
// SOFT_FLOAT: call void asm sideeffect "", "r,~{$1}"(float %1)
4+
void read_float(float *p) {
5+
__asm__("" ::"r"(*p));
6+
}
7+
8+
// SOFT_FLOAT: call void asm sideeffect "", "r,~{$1}"(double %1)
9+
void read_double(double *p) {
10+
__asm__("" :: "r"(*p));
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %clang_cc1 -triple mips64 -fsyntax-only -verify %s
2+
// RUN: %clang_cc1 -triple mips64 -target-feature +soft-float -fsyntax-only -verify=softfloat %s
3+
4+
// expected-no-diagnostics
5+
6+
void test_f(float p) {
7+
float result = p;
8+
__asm__("" :: "f"(result)); // softfloat-error{{invalid input constraint 'f' in asm}}
9+
}

libcxx/modules/std/atomic.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ export namespace std {
111111
using std::atomic_uintmax_t;
112112
using std::atomic_uintptr_t;
113113

114+
#ifndef _LIBCPP_NO_LOCK_FREE_TYPES
114115
using std::atomic_signed_lock_free;
115116
using std::atomic_unsigned_lock_free;
117+
#endif
116118

117119
// [atomics.flag], flag type and operations
118120
using std::atomic_flag;

llvm/include/llvm/BinaryFormat/Dwarf.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -615,21 +615,21 @@ enum AcceleratorTable {
615615

616616
// Uniquify the string hashes and calculate the bucket count for the
617617
// DWARF v5 Accelerator Table. NOTE: This function effectively consumes the
618-
// 'hashes' input parameter.
619-
inline uint32_t getDebugNamesBucketCount(MutableArrayRef<uint32_t> hashes,
620-
uint32_t &uniqueHashCount) {
618+
// 'Hashes' input parameter.
619+
inline std::pair<uint32_t, uint32_t>
620+
getDebugNamesBucketAndHashCount(MutableArrayRef<uint32_t> Hashes) {
621621
uint32_t BucketCount = 0;
622622

623-
sort(hashes);
624-
uniqueHashCount = llvm::unique(hashes) - hashes.begin();
625-
if (uniqueHashCount > 1024)
626-
BucketCount = uniqueHashCount / 4;
627-
else if (uniqueHashCount > 16)
628-
BucketCount = uniqueHashCount / 2;
623+
sort(Hashes);
624+
uint32_t UniqueHashCount = llvm::unique(Hashes) - Hashes.begin();
625+
if (UniqueHashCount > 1024)
626+
BucketCount = UniqueHashCount / 4;
627+
else if (UniqueHashCount > 16)
628+
BucketCount = UniqueHashCount / 2;
629629
else
630-
BucketCount = std::max<uint32_t>(uniqueHashCount, 1);
630+
BucketCount = std::max<uint32_t>(UniqueHashCount, 1);
631631

632-
return BucketCount;
632+
return {BucketCount, UniqueHashCount};
633633
}
634634

635635
// Constants for the GNU pubnames/pubtypes extensions supporting gdb index.

llvm/include/llvm/Passes/CodeGenPassBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ namespace llvm {
111111
/// construction.
112112
template <typename DerivedT> class CodeGenPassBuilder {
113113
public:
114-
explicit CodeGenPassBuilder(LLVMTargetMachine &TM, CGPassBuilderOption Opts,
114+
explicit CodeGenPassBuilder(LLVMTargetMachine &TM,
115+
const CGPassBuilderOption &Opts,
115116
PassInstrumentationCallbacks *PIC)
116117
: TM(TM), Opt(Opts), PIC(PIC) {
117118
// Target could set CGPassBuilderOption::MISchedPostRA to true to achieve

llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ struct MCDCRecord {
385385
enum CondState { MCDC_DontCare = -1, MCDC_False = 0, MCDC_True = 1 };
386386

387387
using TestVector = llvm::SmallVector<CondState>;
388-
using TestVectors = llvm::SmallVector<TestVector>;
388+
using TestVectors = llvm::SmallVector<std::pair<TestVector, CondState>>;
389389
using BoolVector = llvm::SmallVector<bool>;
390390
using TVRowPair = std::pair<unsigned, unsigned>;
391391
using TVPairMap = llvm::DenseMap<unsigned, TVRowPair>;
@@ -426,13 +426,13 @@ struct MCDCRecord {
426426
/// accessing conditions in the TestVectors requires a translation from a
427427
/// ordinal position to actual condition ID. This is done via PosToID[].
428428
CondState getTVCondition(unsigned TestVectorIndex, unsigned Condition) {
429-
return TV[TestVectorIndex][PosToID[Condition]];
429+
return TV[TestVectorIndex].first[PosToID[Condition]];
430430
}
431431

432432
/// Return the Result evaluation for an executed test vector.
433433
/// See MCDCRecordProcessor::RecordTestVector().
434434
CondState getTVResult(unsigned TestVectorIndex) {
435-
return TV[TestVectorIndex][getNumConditions()];
435+
return TV[TestVectorIndex].second;
436436
}
437437

438438
/// Determine whether a given condition (indicated by Condition) is covered

llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ void AccelTableBase::computeBucketCount() {
3838
for (const auto &E : Entries)
3939
Uniques.push_back(E.second.HashValue);
4040

41-
BucketCount = llvm::dwarf::getDebugNamesBucketCount(Uniques, UniqueHashCount);
41+
auto Counts = llvm::dwarf::getDebugNamesBucketAndHashCount(Uniques);
42+
BucketCount = Counts.first;
43+
UniqueHashCount = Counts.second;
4244
}
4345

4446
void AccelTableBase::finalize(AsmPrinter *Asm, StringRef Prefix) {

llvm/lib/ProfileData/Coverage/CoverageMapping.cpp

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,16 @@ class MCDCRecordProcessor : NextIDsBuilder, mcdc::TVIdxBuilder {
370370
/// Mapping of calculated MC/DC Independence Pairs for each condition.
371371
MCDCRecord::TVPairMap IndependencePairs;
372372

373+
/// Storage for ExecVectors
374+
/// ExecVectors is the alias of its 0th element.
375+
std::array<MCDCRecord::TestVectors, 2> ExecVectorsByCond;
376+
373377
/// Actual executed Test Vectors for the boolean expression, based on
374378
/// ExecutedTestVectorBitmap.
375-
MCDCRecord::TestVectors ExecVectors;
379+
MCDCRecord::TestVectors &ExecVectors;
380+
381+
/// Number of False items in ExecVectors
382+
unsigned NumExecVectorsF;
376383

377384
#ifndef NDEBUG
378385
DenseSet<unsigned> TVIdxs;
@@ -385,7 +392,8 @@ class MCDCRecordProcessor : NextIDsBuilder, mcdc::TVIdxBuilder {
385392
: NextIDsBuilder(Branches), TVIdxBuilder(this->NextIDs), Bitmap(Bitmap),
386393
Region(Region), DecisionParams(Region.getDecisionParams()),
387394
Branches(Branches), NumConditions(DecisionParams.NumConditions),
388-
Folded(NumConditions, false), IndependencePairs(NumConditions) {}
395+
Folded(NumConditions, false), IndependencePairs(NumConditions),
396+
ExecVectors(ExecVectorsByCond[false]) {}
389397

390398
private:
391399
// Walk the binary decision diagram and try assigning both false and true to
@@ -415,11 +423,9 @@ class MCDCRecordProcessor : NextIDsBuilder, mcdc::TVIdxBuilder {
415423
continue;
416424

417425
// Copy the completed test vector to the vector of testvectors.
418-
ExecVectors.push_back(TV);
419-
420426
// The final value (T,F) is equal to the last non-dontcare state on the
421427
// path (in a short-circuiting system).
422-
ExecVectors.back().push_back(MCDCCond);
428+
ExecVectorsByCond[MCDCCond].push_back({TV, MCDCCond});
423429
}
424430

425431
// Reset back to DontCare.
@@ -437,6 +443,14 @@ class MCDCRecordProcessor : NextIDsBuilder, mcdc::TVIdxBuilder {
437443
buildTestVector(TV, 0, 0, 0);
438444
assert(TVIdxs.size() == unsigned(NumTestVectors) &&
439445
"TVIdxs wasn't fulfilled");
446+
447+
// Fill ExecVectors order by False items and True items.
448+
// ExecVectors is the alias of ExecVectorsByCond[false], so
449+
// Append ExecVectorsByCond[true] on it.
450+
NumExecVectorsF = ExecVectors.size();
451+
auto &ExecVectorsT = ExecVectorsByCond[true];
452+
ExecVectors.append(std::make_move_iterator(ExecVectorsT.begin()),
453+
std::make_move_iterator(ExecVectorsT.end()));
440454
}
441455

442456
// Find an independence pair for each condition:
@@ -445,13 +459,12 @@ class MCDCRecordProcessor : NextIDsBuilder, mcdc::TVIdxBuilder {
445459
// - All other conditions' values must be equal or marked as "don't care".
446460
void findIndependencePairs() {
447461
unsigned NumTVs = ExecVectors.size();
448-
for (unsigned I = 1; I < NumTVs; ++I) {
449-
const MCDCRecord::TestVector &A = ExecVectors[I];
450-
for (unsigned J = 0; J < I; ++J) {
451-
const MCDCRecord::TestVector &B = ExecVectors[J];
452-
// Enumerate two execution vectors whose outcomes are different.
453-
if (A[NumConditions] == B[NumConditions])
454-
continue;
462+
for (unsigned I = NumExecVectorsF; I < NumTVs; ++I) {
463+
const auto &[A, ACond] = ExecVectors[I];
464+
assert(ACond == MCDCRecord::MCDC_True);
465+
for (unsigned J = 0; J < NumExecVectorsF; ++J) {
466+
const auto &[B, BCond] = ExecVectors[J];
467+
assert(BCond == MCDCRecord::MCDC_False);
455468
unsigned Flip = NumConditions, Idx;
456469
for (Idx = 0; Idx < NumConditions; ++Idx) {
457470
MCDCRecord::CondState ACond = A[Idx], BCond = B[Idx];

llvm/lib/Target/AArch64/AArch64SchedExynosM4.td

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ def M4WriteFMAC3H : SchedWriteRes<[M4UnitFMACH]> { let Latency = 3; }
309309
def M4WriteFMAC3 : SchedWriteRes<[M4UnitFMAC]> { let Latency = 3; }
310310
def M4WriteFMAC4 : SchedWriteRes<[M4UnitFMAC]> { let Latency = 4; }
311311
def M4WriteFMAC4H : SchedWriteRes<[M4UnitFMACH]> { let Latency = 4; }
312-
def M4WriteFMAC5 : SchedWriteRes<[M4UnitFMAC]> { let Latency = 5; }
313312

314313
def M4WriteFSQR7H : SchedWriteRes<[M4UnitFSQRH]> { let Latency = 7;
315314
let ReleaseAtCycles = [6]; }
@@ -495,8 +494,7 @@ def M4WriteMOVI : SchedWriteVariant<[SchedVar<IsZeroFPIdiomPred, [M4WriteZ0]>
495494
// Fast forwarding.
496495
def M4ReadAESM1 : SchedReadAdvance<+1, [M4WriteNCRY1]>;
497496
def M4ReadFMACM1 : SchedReadAdvance<+1, [M4WriteFMAC4,
498-
M4WriteFMAC4H,
499-
M4WriteFMAC5]>;
497+
M4WriteFMAC4H]>;
500498
def M4ReadNMULM1 : SchedReadAdvance<+1, [M4WriteNMUL3]>;
501499
def M4ReadNMULP2 : SchedReadAdvance<-2, [M4WriteNMUL3]>;
502500

llvm/lib/Target/AArch64/AArch64SchedExynosM5.td

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ def M5WriteFDIV12 : SchedWriteRes<[M5UnitFDIV]> { let Latency = 12;
338338

339339
def M5WriteFMAC3 : SchedWriteRes<[M5UnitFMAC]> { let Latency = 3; }
340340
def M5WriteFMAC4 : SchedWriteRes<[M5UnitFMAC]> { let Latency = 4; }
341-
def M5WriteFMAC5 : SchedWriteRes<[M5UnitFMAC]> { let Latency = 5; }
342341

343342
def M5WriteFSQR5 : SchedWriteRes<[M5UnitFSQR]> { let Latency = 5;
344343
let ReleaseAtCycles = [2]; }
@@ -530,8 +529,7 @@ def M5WriteMOVI : SchedWriteVariant<[SchedVar<IsZeroFPIdiomPred, [M5WriteZ0]>
530529
// Fast forwarding.
531530
def M5ReadFM1 : SchedReadAdvance<+1, [M5WriteF2]>;
532531
def M5ReadAESM2 : SchedReadAdvance<+2, [M5WriteNCRY2]>;
533-
def M5ReadFMACM1 : SchedReadAdvance<+1, [M5WriteFMAC4,
534-
M5WriteFMAC5]>;
532+
def M5ReadFMACM1 : SchedReadAdvance<+1, [M5WriteFMAC4]>;
535533
def M5ReadNMULM1 : SchedReadAdvance<+1, [M5WriteNMUL3]>;
536534

537535
//===----------------------------------------------------------------------===//

llvm/lib/Target/Mips/MipsISelLowering.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4128,14 +4128,18 @@ MipsTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
41284128
case 'd': // Address register. Same as 'r' unless generating MIPS16 code.
41294129
case 'y': // Same as 'r'. Exists for compatibility.
41304130
case 'r':
4131-
if (VT == MVT::i32 || VT == MVT::i16 || VT == MVT::i8 || VT == MVT::i1) {
4131+
if ((VT == MVT::i32 || VT == MVT::i16 || VT == MVT::i8 ||
4132+
VT == MVT::i1) ||
4133+
(VT == MVT::f32 && Subtarget.useSoftFloat())) {
41324134
if (Subtarget.inMips16Mode())
41334135
return std::make_pair(0U, &Mips::CPU16RegsRegClass);
41344136
return std::make_pair(0U, &Mips::GPR32RegClass);
41354137
}
4136-
if (VT == MVT::i64 && !Subtarget.isGP64bit())
4138+
if ((VT == MVT::i64 || (VT == MVT::f64 && Subtarget.useSoftFloat())) &&
4139+
!Subtarget.isGP64bit())
41374140
return std::make_pair(0U, &Mips::GPR32RegClass);
4138-
if (VT == MVT::i64 && Subtarget.isGP64bit())
4141+
if ((VT == MVT::i64 || (VT == MVT::f64 && Subtarget.useSoftFloat())) &&
4142+
Subtarget.isGP64bit())
41394143
return std::make_pair(0U, &Mips::GPR64RegClass);
41404144
// This will generate an error message
41414145
return std::make_pair(0U, nullptr);

0 commit comments

Comments
 (0)