Skip to content

Commit

Permalink
Merged main:d6783c7c98ac into amd-gfx:8de17e533347
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
SC llvm team authored and SC llvm team committed Nov 29, 2023
2 parents 8de17e5 + d6783c7 commit 207601c
Show file tree
Hide file tree
Showing 246 changed files with 1,937 additions and 801 deletions.
3 changes: 2 additions & 1 deletion bolt/include/bolt/Core/DIEBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ class DIEBuilder {
void buildCompileUnits(const std::vector<DWARFUnit *> &CUs);
/// Preventing implicit conversions.
template <class T> void buildCompileUnits(T) = delete;
void buildBoth();
/// Builds DWO Unit. For DWARF5 this includes the type units.
void buildDWOUnit(DWARFUnit &U);

/// Returns DWARFUnitInfo for DWARFUnit
DWARFUnitInfo &getUnitInfoByDwarfUnit(const DWARFUnit &DwarfUnit) {
Expand Down
17 changes: 9 additions & 8 deletions bolt/lib/Core/DIEBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,6 @@ void DIEBuilder::buildTypeUnits(const bool Init) {
if (Init)
BuilderState.reset(new State());

unsigned int CUNum = getCUNum(DwarfContext, IsDWO);
getState().CloneUnitCtxMap.resize(CUNum);
DWARFContext::unit_iterator_range CU4TURanges =
IsDWO ? DwarfContext->dwo_types_section_units()
: DwarfContext->types_section_units();

const DWARFUnitIndex &TUIndex = DwarfContext->getTUIndex();
if (!TUIndex.getRows().empty()) {
for (auto &Row : TUIndex.getRows()) {
Expand All @@ -208,6 +202,11 @@ void DIEBuilder::buildTypeUnits(const bool Init) {
true);
}
}
unsigned int CUNum = getCUNum(DwarfContext, IsDWO);
getState().CloneUnitCtxMap.resize(CUNum);
DWARFContext::unit_iterator_range CU4TURanges =
IsDWO ? DwarfContext->dwo_types_section_units()
: DwarfContext->types_section_units();

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

void DIEBuilder::buildBoth() {
void DIEBuilder::buildDWOUnit(DWARFUnit &U) {
BuilderState.release();
BuilderState = std::make_unique<State>();
buildTypeUnits(false);
buildCompileUnits(false);
getState().Type = ProcessingType::CUs;
registerUnit(U, false);
constructFromUnit(U);
}

DIE *DIEBuilder::constructDIEFast(DWARFDie &DDie, DWARFUnit &U,
Expand Down
14 changes: 6 additions & 8 deletions bolt/lib/Rewrite/DWARFRewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ emitUnit(DIEBuilder &DIEBldr, DIEStreamer &Streamer, DWARFUnit &Unit) {

static void emitDWOBuilder(const std::string &DWOName,
DIEBuilder &DWODIEBuilder, DWARFRewriter &Rewriter,
const DWARFUnit &SplitCU, DWARFUnit &CU,
DWARFUnit &SplitCU, DWARFUnit &CU,
DWARFRewriter::DWPState &State,
DebugLocWriter &LocWriter) {
// Populate debug_info and debug_abbrev for current dwo into StringRef.
Expand All @@ -498,17 +498,15 @@ static void emitDWOBuilder(const std::string &DWOName,
DWARFRewriter::UnitMetaVectorType TUMetaVector;
DWARFRewriter::UnitMeta CUMI = {0, 0, 0};
if (SplitCU.getContext().getMaxDWOVersion() >= 5) {
// TODO: Handle DWP as input. Right now it will iterate over all of CUs and
// TUs
for (std::unique_ptr<llvm::DWARFUnit> &CU :
SplitCU.getContext().dwo_info_section_units()) {
if (!CU->isTypeUnit())
continue;
DWARFRewriter::UnitMeta MI =
emitUnit(DWODIEBuilder, *Streamer, *CU.get());
if (CU->isTypeUnit())
TUMetaVector.emplace_back(MI);
else
CUMI = MI;
TUMetaVector.emplace_back(MI);
}
CUMI = emitUnit(DWODIEBuilder, *Streamer, SplitCU);
} else {
for (std::unique_ptr<llvm::DWARFUnit> &CU :
SplitCU.getContext().dwo_compile_units())
Expand Down Expand Up @@ -707,7 +705,7 @@ void DWARFRewriter::updateDebugInfo() {
// Skipping CUs that failed to load.
if (SplitCU) {
DIEBuilder DWODIEBuilder(&(*SplitCU)->getContext(), true);
DWODIEBuilder.buildBoth();
DWODIEBuilder.buildDWOUnit(**SplitCU);
std::string DWOName = updateDWONameCompDir(
*Unit, *DIEBlder, *DIEBlder->getUnitDIEbyUnit(*Unit));

Expand Down
Loading

0 comments on commit 207601c

Please sign in to comment.