Skip to content

Commit 94ce1b8

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merge llvm/main into amd-debug
2 parents 8a08d84 + e49946b commit 94ce1b8

File tree

19 files changed

+2089
-1666
lines changed

19 files changed

+2089
-1666
lines changed

clang/include/clang/Basic/riscv_vector.td

Lines changed: 77 additions & 685 deletions
Large diffs are not rendered by default.

clang/lib/CodeGen/TargetBuiltins/RISCV.cpp

Lines changed: 945 additions & 4 deletions
Large diffs are not rendered by default.

clang/unittests/Format/AlignBracketsTest.cpp

Lines changed: 784 additions & 0 deletions
Large diffs are not rendered by default.

clang/unittests/Format/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Format tests have few LLVM and Clang dependencies, so linking it as a
22
# distinct target enables faster iteration times at low cost.
33
add_distinct_clang_unittest(FormatTests
4+
AlignBracketsTest.cpp
45
BracesInserterTest.cpp
56
BracesRemoverTest.cpp
67
CleanupTest.cpp

clang/unittests/Format/FormatTest.cpp

Lines changed: 0 additions & 761 deletions
Large diffs are not rendered by default.

lldb/source/Core/ModuleList.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,6 @@ class SharedModuleList {
844844
}
845845

846846
bool RemoveIfOrphaned(const Module *module_ptr) {
847-
if (!module_ptr)
848-
return false;
849847
std::lock_guard<std::recursive_mutex> guard(GetMutex());
850848
RemoveFromMap(*module_ptr, /*if_orphaned=*/true);
851849
return m_list.RemoveIfOrphaned(module_ptr);
@@ -982,7 +980,7 @@ class SharedModuleList {
982980
};
983981

984982
struct SharedModuleListInfo {
985-
SharedModuleList module_list;
983+
ModuleList module_list;
986984
ModuleListProperties module_list_properties;
987985
};
988986
}
@@ -1000,7 +998,7 @@ static SharedModuleListInfo &GetSharedModuleListInfo()
1000998
return *g_shared_module_list_info;
1001999
}
10021000

1003-
static SharedModuleList &GetSharedModuleList() {
1001+
static ModuleList &GetSharedModuleList() {
10041002
return GetSharedModuleListInfo().module_list;
10051003
}
10061004

@@ -1010,8 +1008,8 @@ ModuleListProperties &ModuleList::GetGlobalModuleListProperties() {
10101008

10111009
bool ModuleList::ModuleIsInCache(const Module *module_ptr) {
10121010
if (module_ptr) {
1013-
SharedModuleList &shared_module_list = GetSharedModuleList();
1014-
return shared_module_list.FindModule(*module_ptr).get() != nullptr;
1011+
ModuleList &shared_module_list = GetSharedModuleList();
1012+
return shared_module_list.FindModule(module_ptr).get() != nullptr;
10151013
}
10161014
return false;
10171015
}
@@ -1034,8 +1032,9 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
10341032
const FileSpecList *module_search_paths_ptr,
10351033
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
10361034
bool *did_create_ptr, bool always_create) {
1037-
SharedModuleList &shared_module_list = GetSharedModuleList();
1038-
std::lock_guard<std::recursive_mutex> guard(shared_module_list.GetMutex());
1035+
ModuleList &shared_module_list = GetSharedModuleList();
1036+
std::lock_guard<std::recursive_mutex> guard(
1037+
shared_module_list.m_modules_mutex);
10391038
char path[PATH_MAX];
10401039

10411040
Status error;

llvm/lib/Passes/StandardInstrumentations.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ static cl::opt<bool> PrintPassNumbers(
118118
"print-pass-numbers", cl::init(false), cl::Hidden,
119119
cl::desc("Print pass names and their ordinals"));
120120

121-
static cl::opt<unsigned> PrintBeforePassNumber(
122-
"print-before-pass-number", cl::init(0), cl::Hidden,
123-
cl::desc("Print IR before the pass with this number as "
121+
static cl::list<unsigned> PrintBeforePassNumber(
122+
"print-before-pass-number", cl::CommaSeparated, cl::Hidden,
123+
cl::desc("Print IR before the passes with specified numbers as "
124124
"reported by print-pass-numbers"));
125125

126-
static cl::opt<unsigned>
127-
PrintAfterPassNumber("print-after-pass-number", cl::init(0), cl::Hidden,
128-
cl::desc("Print IR after the pass with this number as "
129-
"reported by print-pass-numbers"));
126+
static cl::list<unsigned> PrintAfterPassNumber(
127+
"print-after-pass-number", cl::CommaSeparated, cl::Hidden,
128+
cl::desc("Print IR after the passes with specified numbers as "
129+
"reported by print-pass-numbers"));
130130

131131
static cl::opt<std::string> IRDumpDirectory(
132132
"ir-dump-directory",
@@ -984,24 +984,24 @@ bool PrintIRInstrumentation::shouldPrintAfterPass(StringRef PassID) {
984984

985985
bool PrintIRInstrumentation::shouldPrintBeforeCurrentPassNumber() {
986986
return shouldPrintBeforeSomePassNumber() &&
987-
(CurrentPassNumber == PrintBeforePassNumber);
987+
(is_contained(PrintBeforePassNumber, CurrentPassNumber));
988988
}
989989

990990
bool PrintIRInstrumentation::shouldPrintAfterCurrentPassNumber() {
991991
return shouldPrintAfterSomePassNumber() &&
992-
(CurrentPassNumber == PrintAfterPassNumber);
992+
(is_contained(PrintAfterPassNumber, CurrentPassNumber));
993993
}
994994

995995
bool PrintIRInstrumentation::shouldPrintPassNumbers() {
996996
return PrintPassNumbers;
997997
}
998998

999999
bool PrintIRInstrumentation::shouldPrintBeforeSomePassNumber() {
1000-
return PrintBeforePassNumber > 0;
1000+
return !PrintBeforePassNumber.empty();
10011001
}
10021002

10031003
bool PrintIRInstrumentation::shouldPrintAfterSomePassNumber() {
1004-
return PrintAfterPassNumber > 0;
1004+
return !PrintAfterPassNumber.empty();
10051005
}
10061006

10071007
void PrintIRInstrumentation::registerCallbacks(

llvm/lib/Target/AMDGPU/AMDGPU.td

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,12 @@ def FeatureGFX9Insts : SubtargetFeature<"gfx9-insts",
419419
"Additional instructions for GFX9+"
420420
>;
421421

422+
def FeatureRequiresAlignedVGPRs : SubtargetFeature<"vgpr-align2",
423+
"RequiresAlignVGPR",
424+
"true",
425+
"VGPR and AGPR tuple operands require even alignment"
426+
>;
427+
422428
def FeatureGFX90AInsts : SubtargetFeature<"gfx90a-insts",
423429
"GFX90AInsts",
424430
"true",
@@ -1721,6 +1727,7 @@ def FeatureISAVersion9_0_9 : FeatureSet<
17211727
def FeatureISAVersion9_0_A : FeatureSet<
17221728
!listconcat(FeatureISAVersion9_0_MI_Common.Features,
17231729
[FeatureGFX90AInsts,
1730+
FeatureRequiresAlignedVGPRs,
17241731
FeatureFmacF64Inst,
17251732
FeatureDPALU_DPP,
17261733
FeaturePackedFP32Ops,
@@ -1743,6 +1750,7 @@ def FeatureISAVersion9_4_Common : FeatureSet<
17431750
[FeatureGFX9,
17441751
FeatureGFX90AInsts,
17451752
FeatureGFX940Insts,
1753+
FeatureRequiresAlignedVGPRs,
17461754
FeatureFmaMixInsts,
17471755
FeatureLDSBankCount32,
17481756
FeatureDLInsts,
@@ -2019,6 +2027,7 @@ def FeatureISAVersion12 : FeatureSet<
20192027
def FeatureISAVersion12_50 : FeatureSet<
20202028
[FeatureGFX12,
20212029
FeatureGFX1250Insts,
2030+
FeatureRequiresAlignedVGPRs,
20222031
FeatureCUStores,
20232032
FeatureAddressableLocalMemorySize327680,
20242033
FeatureCuMode,

llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static cl::opt<unsigned> PromoteAllocaToVectorMaxRegs(
7070
"amdgpu-promote-alloca-to-vector-max-regs",
7171
cl::desc(
7272
"Maximum vector size (in 32b registers) to use when promoting alloca"),
73-
cl::init(16));
73+
cl::init(32));
7474

7575
// Use up to 1/4 of available register budget for vectorization.
7676
// FIXME: Increase the limit for whole function budgets? Perhaps x2?
@@ -287,8 +287,12 @@ void AMDGPUPromoteAllocaImpl::sortAllocasToPromote(
287287

288288
void AMDGPUPromoteAllocaImpl::setFunctionLimits(const Function &F) {
289289
// Load per function limits, overriding with global options where appropriate.
290+
// R600 register tuples/aliasing are fragile with large vector promotions so
291+
// apply architecture specific limit here.
292+
const int R600MaxVectorRegs = 16;
290293
MaxVectorRegs = F.getFnAttributeAsParsedInteger(
291-
"amdgpu-promote-alloca-to-vector-max-regs", PromoteAllocaToVectorMaxRegs);
294+
"amdgpu-promote-alloca-to-vector-max-regs",
295+
IsAMDGCN ? PromoteAllocaToVectorMaxRegs : R600MaxVectorRegs);
292296
if (PromoteAllocaToVectorMaxRegs.getNumOccurrences())
293297
MaxVectorRegs = PromoteAllocaToVectorMaxRegs;
294298
VGPRBudgetRatio = F.getFnAttributeAsParsedInteger(

llvm/lib/Target/AMDGPU/GCNSubtarget.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
198198
bool DynamicVGPR = false;
199199
bool DynamicVGPRBlockSize32 = false;
200200
bool HasVMemToLDSLoad = false;
201+
bool RequiresAlignVGPR = false;
201202

202203
// This should not be used directly. 'TargetID' tracks the dynamic settings
203204
// for SRAMECC.
@@ -1350,7 +1351,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
13501351
}
13511352

13521353
/// Return if operations acting on VGPR tuples require even alignment.
1353-
bool needsAlignedVGPRs() const { return GFX90AInsts || GFX1250Insts; }
1354+
bool needsAlignedVGPRs() const { return RequiresAlignVGPR; }
13541355

13551356
/// Return true if the target has the S_PACK_HL_B32_B16 instruction.
13561357
bool hasSPackHL() const { return GFX11Insts; }

0 commit comments

Comments
 (0)