Skip to content

Commit 38e7e06

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:8b36a19b3fe6 into amd-gfx:f05b7dadd0b5
Local branch amd-gfx f05b7da Merged main:8775947633bf into amd-gfx:ab0d8a798ca6 Remote branch main 8b36a19 AMDGPU/Docs: Memory model updates for GFX940, GFX941, GFX942 (llvm#71091)
2 parents f05b7da + 8b36a19 commit 38e7e06

File tree

87 files changed

+1125
-1786
lines changed

Some content is hidden

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

87 files changed

+1125
-1786
lines changed

clang/lib/CodeGen/CGBlocks.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM,
164164
CGM.getLangOpts().getGC() == LangOptions::NonGC) {
165165
descName = getBlockDescriptorName(blockInfo, CGM);
166166
if (llvm::GlobalValue *desc = CGM.getModule().getNamedValue(descName))
167-
return llvm::ConstantExpr::getBitCast(desc,
168-
CGM.getBlockDescriptorType());
167+
return desc;
169168
}
170169

171170
// If there isn't an equivalent block descriptor global variable, create a new
@@ -242,7 +241,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM,
242241
global->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
243242
}
244243

245-
return llvm::ConstantExpr::getBitCast(global, CGM.getBlockDescriptorType());
244+
return global;
246245
}
247246

248247
/*

clang/lib/CodeGen/CGDeclCXX.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D,
126126
CGM.getLLVMContext(), CGM.getContext().getTargetAddressSpace(DestAS));
127127
auto SrcAS = D.getType().getQualifiers().getAddressSpace();
128128
if (DestAS == SrcAS)
129-
Argument = llvm::ConstantExpr::getBitCast(Addr.getPointer(), DestTy);
129+
Argument = Addr.getPointer();
130130
else
131131
// FIXME: On addr space mismatch we are passing NULL. The generation
132132
// of the global destructor function should be adjusted accordingly.
@@ -167,8 +167,7 @@ void CodeGenFunction::EmitInvariantStart(llvm::Constant *Addr, CharUnits Size) {
167167

168168
// Emit a call with the size in bytes of the object.
169169
uint64_t Width = Size.getQuantity();
170-
llvm::Value *Args[2] = { llvm::ConstantInt::getSigned(Int64Ty, Width),
171-
llvm::ConstantExpr::getBitCast(Addr, Int8PtrTy)};
170+
llvm::Value *Args[2] = {llvm::ConstantInt::getSigned(Int64Ty, Width), Addr};
172171
Builder.CreateCall(InvariantStart, Args);
173172
}
174173

clang/lib/CodeGen/CGExprConstant.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,13 +1630,8 @@ namespace {
16301630
IndexValues[i] = llvm::ConstantInt::get(CGM.Int32Ty, Indices[i]);
16311631
}
16321632

1633-
// Form a GEP and then bitcast to the placeholder type so that the
1634-
// replacement will succeed.
1635-
llvm::Constant *location =
1636-
llvm::ConstantExpr::getInBoundsGetElementPtr(BaseValueTy,
1637-
Base, IndexValues);
1638-
location = llvm::ConstantExpr::getBitCast(location,
1639-
placeholder->getType());
1633+
llvm::Constant *location = llvm::ConstantExpr::getInBoundsGetElementPtr(
1634+
BaseValueTy, Base, IndexValues);
16401635

16411636
Locations.insert({placeholder, location});
16421637
}
@@ -2037,8 +2032,6 @@ ConstantLValue
20372032
ConstantLValueEmitter::VisitAddrLabelExpr(const AddrLabelExpr *E) {
20382033
assert(Emitter.CGF && "Invalid address of label expression outside function");
20392034
llvm::Constant *Ptr = Emitter.CGF->GetAddrOfLabel(E->getLabel());
2040-
Ptr = llvm::ConstantExpr::getBitCast(Ptr,
2041-
CGM.getTypes().ConvertType(E->getType()));
20422035
return Ptr;
20432036
}
20442037

clang/test/Driver/dragonfly.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %clang --target=x86_64-pc-dragonfly -### %s 2> %t.log
2-
// RUN: FileCheck -input-file %t.log %s
1+
// RUN: %clang --target=x86_64-pc-dragonfly --sysroot= -### %s 2>&1 | FileCheck %s
32

43
// CHECK: "-cc1" "-triple" "x86_64-pc-dragonfly"
54
// CHECK: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/usr/libexec/ld-elf.so.{{.*}}" "--hash-style=gnu" "--enable-new-dtags" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "-L{{.*}}/../lib" "-L/usr/lib" "-L/usr/lib/gcc80" "{{.*}}.o" "-rpath" "{{.*}}gcc80{{.*}}" "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o"

compiler-rt/lib/profile/InstrProfiling.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ COMPILER_RT_VISIBILITY void __llvm_profile_reset_counters(void) {
9090
lprofSetProfileDumped(0);
9191
}
9292

93-
COMPILER_RT_VISIBILITY int hasCorrelation() {
93+
COMPILER_RT_VISIBILITY int __llvm_profile_has_correlation() {
9494
return (__llvm_profile_get_version() & VARIANT_MASK_DBG_CORRELATE) != 0ULL;
9595
}

compiler-rt/lib/profile/InstrProfiling.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ uint64_t __llvm_profile_get_magic(void);
262262
uint64_t __llvm_profile_get_version(void);
263263

264264
/*! \brief If the binary is compiled with profile correlation. */
265-
int hasCorrelation();
265+
int __llvm_profile_has_correlation();
266266

267267
/*! \brief Get the number of entries in the profile data section. */
268268
uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *Begin,

compiler-rt/lib/profile/InstrProfilingBuffer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ uint64_t __llvm_profile_get_size_for_buffer(void) {
5656
COMPILER_RT_VISIBILITY
5757
uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *Begin,
5858
const __llvm_profile_data *End) {
59-
if (hasCorrelation())
59+
if (__llvm_profile_has_correlation())
6060
return 0;
6161
intptr_t BeginI = (intptr_t)Begin, EndI = (intptr_t)End;
6262
return ((EndI + sizeof(__llvm_profile_data) - 1) - BeginI) /
@@ -66,7 +66,7 @@ uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *Begin,
6666
COMPILER_RT_VISIBILITY
6767
uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin,
6868
const __llvm_profile_data *End) {
69-
if (hasCorrelation())
69+
if (__llvm_profile_has_correlation())
7070
return 0;
7171
return __llvm_profile_get_num_data(Begin, End) * sizeof(__llvm_profile_data);
7272
}
@@ -98,7 +98,7 @@ uint64_t __llvm_profile_get_num_bitmap_bytes(const char *Begin,
9898

9999
COMPILER_RT_VISIBILITY
100100
uint64_t __llvm_profile_get_name_size(const char *Begin, const char *End) {
101-
if (hasCorrelation())
101+
if (__llvm_profile_has_correlation())
102102
return 0;
103103
return End - Begin;
104104
}

compiler-rt/lib/profile/InstrProfilingMerge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
141141

142142
// Merge counters by iterating the entire counter section when correlation is
143143
// enabled.
144-
if (hasCorrelation()) {
144+
if (__llvm_profile_has_correlation()) {
145145
for (SrcCounter = SrcCountersStart,
146146
DstCounter = __llvm_profile_begin_counters();
147147
SrcCounter < SrcCountersEnd;) {

compiler-rt/lib/profile/InstrProfilingWriter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin,
262262
const char *BitmapBegin, const char *BitmapEnd,
263263
VPDataReaderType *VPDataReader, const char *NamesBegin,
264264
const char *NamesEnd, int SkipNameDataWrite) {
265-
int ProfileCorrelation = hasCorrelation();
265+
int ProfileCorrelation = __llvm_profile_has_correlation();
266266

267267
/* Calculate size of sections. */
268268
const uint64_t DataSectionSize =

lldb/docs/resources/test.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,23 +483,23 @@ run as part of a test suite.
483483

484484
::
485485

486-
$ ./bin/llvm-lit -sv tools/lldb/test --filter <test>
486+
$ ./bin/llvm-lit -sv <llvm-project-root>/lldb/test --filter <test>
487487

488488

489489
Because lit automatically scans a directory for tests, it's also possible to
490490
pass a subdirectory to run a specific subset of the tests.
491491

492492
::
493493

494-
$ ./bin/llvm-lit -sv tools/lldb/test/Shell/Commands/CommandScriptImmediateOutput
494+
$ ./bin/llvm-lit -sv <llvm-project-root>/lldb/test/Shell/Commands/CommandScriptImmediateOutput
495495

496496

497497
For the SB API tests it is possible to forward arguments to ``dotest.py`` by
498498
passing ``--param`` to lit and setting a value for ``dotest-args``.
499499

500500
::
501501

502-
$ ./bin/llvm-lit -sv tools/lldb/test --param dotest-args='-C gcc'
502+
$ ./bin/llvm-lit -sv <llvm-project-root>/lldb/test --param dotest-args='-C gcc'
503503

504504

505505
Below is an overview of running individual test in the unit and API test suites

lldb/include/lldb/Symbol/SymbolFile.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,12 @@ class SymbolFile : public PluginInterface {
445445
/// contains the keys "type", "symfile", and "separate-debug-info-files".
446446
/// "type" can be used to assume the structure of each object in
447447
/// "separate-debug-info-files".
448-
virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d) {
448+
/// \param errors_only
449+
/// If true, then only return separate debug info files that encountered
450+
/// errors during loading. If false, then return all expected separate
451+
/// debug info files, regardless of whether they were successfully loaded.
452+
virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d,
453+
bool errors_only) {
449454
return false;
450455
};
451456

lldb/source/Commands/CommandObjectTarget.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,11 +1452,11 @@ static bool DumpModuleSymbolFile(Stream &strm, Module *module) {
14521452
}
14531453

14541454
static bool GetSeparateDebugInfoList(StructuredData::Array &list,
1455-
Module *module) {
1455+
Module *module, bool errors_only) {
14561456
if (module) {
14571457
if (SymbolFile *symbol_file = module->GetSymbolFile(/*can_create=*/true)) {
14581458
StructuredData::Dictionary d;
1459-
if (symbol_file->GetSeparateDebugInfo(d)) {
1459+
if (symbol_file->GetSeparateDebugInfo(d, errors_only)) {
14601460
list.AddItem(
14611461
std::make_shared<StructuredData::Dictionary>(std::move(d)));
14621462
return true;
@@ -2561,7 +2561,10 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles
25612561
m_json.SetCurrentValue(true);
25622562
m_json.SetOptionWasSet();
25632563
break;
2564-
2564+
case 'e':
2565+
m_errors_only.SetCurrentValue(true);
2566+
m_errors_only.SetOptionWasSet();
2567+
break;
25652568
default:
25662569
llvm_unreachable("Unimplemented option");
25672570
}
@@ -2570,13 +2573,15 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles
25702573

25712574
void OptionParsingStarting(ExecutionContext *execution_context) override {
25722575
m_json.Clear();
2576+
m_errors_only.Clear();
25732577
}
25742578

25752579
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
25762580
return llvm::ArrayRef(g_target_modules_dump_separate_debug_info_options);
25772581
}
25782582

25792583
OptionValueBoolean m_json = false;
2584+
OptionValueBoolean m_errors_only = false;
25802585
};
25812586

25822587
protected:
@@ -2607,7 +2612,8 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles
26072612
break;
26082613

26092614
if (GetSeparateDebugInfoList(separate_debug_info_lists_by_module,
2610-
module_sp.get()))
2615+
module_sp.get(),
2616+
bool(m_options.m_errors_only)))
26112617
num_dumped++;
26122618
}
26132619
} else {
@@ -2628,7 +2634,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles
26282634
break;
26292635
Module *module = module_list.GetModulePointerAtIndex(i);
26302636
if (GetSeparateDebugInfoList(separate_debug_info_lists_by_module,
2631-
module))
2637+
module, bool(m_options.m_errors_only)))
26322638
num_dumped++;
26332639
}
26342640
} else
@@ -2639,11 +2645,13 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles
26392645

26402646
if (num_dumped > 0) {
26412647
Stream &strm = result.GetOutputStream();
2648+
// Display the debug info files in some format.
26422649
if (m_options.m_json) {
2650+
// JSON format
26432651
separate_debug_info_lists_by_module.Dump(strm,
26442652
/*pretty_print=*/true);
26452653
} else {
2646-
// List the debug info files in human readable form.
2654+
// Human-readable table format
26472655
separate_debug_info_lists_by_module.ForEach(
26482656
[&result, &strm](StructuredData::Object *obj) {
26492657
if (!obj) {

lldb/source/Commands/Options.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ let Command = "target modules dump symtab" in {
1010

1111
let Command = "target modules dump separate debug info" in {
1212
def tm_json : Option<"json", "j">, Group<1>,
13-
Desc<"Output the details in JSON format.">;
13+
Desc<"Output the details in JSON format.">;
14+
def tm_errors_only : Option<"errors-only", "e">, Group<1>,
15+
Desc<"Filter to show only debug info files with errors.">;
1416
}
1517

1618
let Command = "help" in {

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4243,7 +4243,8 @@ void SymbolFileDWARF::DumpClangAST(Stream &s) {
42434243
clang->Dump(s.AsRawOstream());
42444244
}
42454245

4246-
bool SymbolFileDWARF::GetSeparateDebugInfo(StructuredData::Dictionary &d) {
4246+
bool SymbolFileDWARF::GetSeparateDebugInfo(StructuredData::Dictionary &d,
4247+
bool errors_only) {
42474248
StructuredData::Array separate_debug_info_files;
42484249
DWARFDebugInfo &info = DebugInfo();
42494250
const size_t num_cus = info.GetNumUnits();
@@ -4296,7 +4297,8 @@ bool SymbolFileDWARF::GetSeparateDebugInfo(StructuredData::Dictionary &d) {
42964297
dwarf_cu->GetDwoError().AsCString("unknown"));
42974298
}
42984299
dwo_data->AddBooleanItem("loaded", dwo_symfile != nullptr);
4299-
separate_debug_info_files.AddItem(dwo_data);
4300+
if (!errors_only || dwo_data->HasKey("error"))
4301+
separate_debug_info_files.AddItem(dwo_data);
43004302
}
43014303

43024304
d.AddStringItem("type", "dwo");

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ class SymbolFileDWARF : public SymbolFileCommon {
268268
void DumpClangAST(Stream &s) override;
269269

270270
/// List separate dwo files.
271-
bool GetSeparateDebugInfo(StructuredData::Dictionary &d) override;
271+
bool GetSeparateDebugInfo(StructuredData::Dictionary &d,
272+
bool errors_only) override;
272273

273274
DWARFContext &GetDWARFContext() { return m_context; }
274275

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ void SymbolFileDWARFDebugMap::DumpClangAST(Stream &s) {
12781278
}
12791279

12801280
bool SymbolFileDWARFDebugMap::GetSeparateDebugInfo(
1281-
lldb_private::StructuredData::Dictionary &d) {
1281+
lldb_private::StructuredData::Dictionary &d, bool errors_only) {
12821282
StructuredData::Array separate_debug_info_files;
12831283
const uint32_t cu_count = GetNumCompileUnits();
12841284
for (uint32_t cu_idx = 0; cu_idx < cu_count; ++cu_idx) {
@@ -1302,7 +1302,8 @@ bool SymbolFileDWARFDebugMap::GetSeparateDebugInfo(
13021302
oso_data->AddStringItem("error", info.oso_load_error.AsCString());
13031303
}
13041304
oso_data->AddBooleanItem("loaded", loaded_successfully);
1305-
separate_debug_info_files.AddItem(oso_data);
1305+
if (!errors_only || oso_data->HasKey("error"))
1306+
separate_debug_info_files.AddItem(oso_data);
13061307
}
13071308

13081309
d.AddStringItem("type", "oso");

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ class SymbolFileDWARFDebugMap : public SymbolFileCommon {
136136
void DumpClangAST(Stream &s) override;
137137

138138
/// List separate oso files.
139-
bool GetSeparateDebugInfo(StructuredData::Dictionary &d) override;
139+
bool GetSeparateDebugInfo(StructuredData::Dictionary &d,
140+
bool errors_only) override;
140141

141142
// PluginInterface protocol
142143
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }

lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class TestDumpDWO(lldbtest.TestBase):
1313
NO_DEBUG_INFO_TESTCASE = True
1414

15-
def get_dwos_from_json(self):
15+
def get_dwos_from_json_output(self):
1616
"""Returns a dictionary of `symfile` -> {`dwo_name` -> dwo_info object}."""
1717
result = {}
1818
output = json.loads(self.res.GetOutput())
@@ -42,7 +42,7 @@ def test_dwos_loaded_json_output(self):
4242
self.runCmd("target modules dump separate-debug-info --json")
4343

4444
# Check the output
45-
output = self.get_dwos_from_json()
45+
output = self.get_dwos_from_json_output()
4646
self.assertTrue(output[exe]["main.dwo"]["loaded"])
4747
self.assertTrue(output[exe]["foo.dwo"]["loaded"])
4848

@@ -55,21 +55,27 @@ def test_dwos_not_loaded_json_output(self):
5555
main_dwo = self.getBuildArtifact("main.dwo")
5656
foo_dwo = self.getBuildArtifact("foo.dwo")
5757

58-
# REMOVE the dwo files
58+
# REMOVE one of the dwo files
5959
os.unlink(main_dwo)
60-
os.unlink(foo_dwo)
6160

6261
target = self.dbg.CreateTarget(exe)
6362
self.assertTrue(target, lldbtest.VALID_TARGET)
6463

6564
self.runCmd("target modules dump separate-debug-info --json")
6665

6766
# Check the output
68-
output = self.get_dwos_from_json()
67+
output = self.get_dwos_from_json_output()
68+
self.assertFalse(output[exe]["main.dwo"]["loaded"])
69+
self.assertIn("error", output[exe]["main.dwo"])
70+
self.assertTrue(output[exe]["foo.dwo"]["loaded"])
71+
self.assertNotIn("error", output[exe]["foo.dwo"])
72+
73+
# Check with --errors-only
74+
self.runCmd("target modules dump separate-debug-info --json --errors-only")
75+
output = self.get_dwos_from_json_output()
6976
self.assertFalse(output[exe]["main.dwo"]["loaded"])
70-
self.assertFalse(output[exe]["foo.dwo"]["loaded"])
7177
self.assertIn("error", output[exe]["main.dwo"])
72-
self.assertIn("error", output[exe]["foo.dwo"])
78+
self.assertNotIn("foo.dwo", output[exe])
7379

7480
@skipIfRemote
7581
@skipIfDarwin

0 commit comments

Comments
 (0)