Skip to content

Commit 207601c

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:d6783c7c98ac into amd-gfx:8de17e533347
Local branch amd-gfx 8de17e5 Merged main:1a041a3ad8a0 into amd-gfx:5e0dd61a0e31 Remote branch main d6783c7 Revert "[libc][bazel] Add copts to libc_support_library" (llvm#73723)
2 parents 8de17e5 + d6783c7 commit 207601c

File tree

246 files changed

+1937
-801
lines changed

Some content is hidden

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

246 files changed

+1937
-801
lines changed

bolt/include/bolt/Core/DIEBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ class DIEBuilder {
273273
void buildCompileUnits(const std::vector<DWARFUnit *> &CUs);
274274
/// Preventing implicit conversions.
275275
template <class T> void buildCompileUnits(T) = delete;
276-
void buildBoth();
276+
/// Builds DWO Unit. For DWARF5 this includes the type units.
277+
void buildDWOUnit(DWARFUnit &U);
277278

278279
/// Returns DWARFUnitInfo for DWARFUnit
279280
DWARFUnitInfo &getUnitInfoByDwarfUnit(const DWARFUnit &DwarfUnit) {

bolt/lib/Core/DIEBuilder.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,6 @@ void DIEBuilder::buildTypeUnits(const bool Init) {
193193
if (Init)
194194
BuilderState.reset(new State());
195195

196-
unsigned int CUNum = getCUNum(DwarfContext, IsDWO);
197-
getState().CloneUnitCtxMap.resize(CUNum);
198-
DWARFContext::unit_iterator_range CU4TURanges =
199-
IsDWO ? DwarfContext->dwo_types_section_units()
200-
: DwarfContext->types_section_units();
201-
202196
const DWARFUnitIndex &TUIndex = DwarfContext->getTUIndex();
203197
if (!TUIndex.getRows().empty()) {
204198
for (auto &Row : TUIndex.getRows()) {
@@ -208,6 +202,11 @@ void DIEBuilder::buildTypeUnits(const bool Init) {
208202
true);
209203
}
210204
}
205+
unsigned int CUNum = getCUNum(DwarfContext, IsDWO);
206+
getState().CloneUnitCtxMap.resize(CUNum);
207+
DWARFContext::unit_iterator_range CU4TURanges =
208+
IsDWO ? DwarfContext->dwo_types_section_units()
209+
: DwarfContext->types_section_units();
211210

212211
getState().Type = ProcessingType::DWARF4TUs;
213212
for (std::unique_ptr<DWARFUnit> &DU : CU4TURanges)
@@ -278,11 +277,13 @@ void DIEBuilder::buildCompileUnits(const std::vector<DWARFUnit *> &CUs) {
278277
constructFromUnit(*DU);
279278
}
280279

281-
void DIEBuilder::buildBoth() {
280+
void DIEBuilder::buildDWOUnit(DWARFUnit &U) {
282281
BuilderState.release();
283282
BuilderState = std::make_unique<State>();
284283
buildTypeUnits(false);
285-
buildCompileUnits(false);
284+
getState().Type = ProcessingType::CUs;
285+
registerUnit(U, false);
286+
constructFromUnit(U);
286287
}
287288

288289
DIE *DIEBuilder::constructDIEFast(DWARFDie &DDie, DWARFUnit &U,

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ emitUnit(DIEBuilder &DIEBldr, DIEStreamer &Streamer, DWARFUnit &Unit) {
481481

482482
static void emitDWOBuilder(const std::string &DWOName,
483483
DIEBuilder &DWODIEBuilder, DWARFRewriter &Rewriter,
484-
const DWARFUnit &SplitCU, DWARFUnit &CU,
484+
DWARFUnit &SplitCU, DWARFUnit &CU,
485485
DWARFRewriter::DWPState &State,
486486
DebugLocWriter &LocWriter) {
487487
// Populate debug_info and debug_abbrev for current dwo into StringRef.
@@ -498,17 +498,15 @@ static void emitDWOBuilder(const std::string &DWOName,
498498
DWARFRewriter::UnitMetaVectorType TUMetaVector;
499499
DWARFRewriter::UnitMeta CUMI = {0, 0, 0};
500500
if (SplitCU.getContext().getMaxDWOVersion() >= 5) {
501-
// TODO: Handle DWP as input. Right now it will iterate over all of CUs and
502-
// TUs
503501
for (std::unique_ptr<llvm::DWARFUnit> &CU :
504502
SplitCU.getContext().dwo_info_section_units()) {
503+
if (!CU->isTypeUnit())
504+
continue;
505505
DWARFRewriter::UnitMeta MI =
506506
emitUnit(DWODIEBuilder, *Streamer, *CU.get());
507-
if (CU->isTypeUnit())
508-
TUMetaVector.emplace_back(MI);
509-
else
510-
CUMI = MI;
507+
TUMetaVector.emplace_back(MI);
511508
}
509+
CUMI = emitUnit(DWODIEBuilder, *Streamer, SplitCU);
512510
} else {
513511
for (std::unique_ptr<llvm::DWARFUnit> &CU :
514512
SplitCU.getContext().dwo_compile_units())
@@ -707,7 +705,7 @@ void DWARFRewriter::updateDebugInfo() {
707705
// Skipping CUs that failed to load.
708706
if (SplitCU) {
709707
DIEBuilder DWODIEBuilder(&(*SplitCU)->getContext(), true);
710-
DWODIEBuilder.buildBoth();
708+
DWODIEBuilder.buildDWOUnit(**SplitCU);
711709
std::string DWOName = updateDWONameCompDir(
712710
*Unit, *DIEBlder, *DIEBlder->getUnitDIEbyUnit(*Unit));
713711

0 commit comments

Comments
 (0)