Skip to content

Commit dfe7807

Browse files
committed
Move common access outside of parallel function
1 parent 7d27ec2 commit dfe7807

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -669,20 +669,12 @@ void DWARFRewriter::updateDebugInfo() {
669669
auto processSplitCU = [&](DWARFUnit &Unit, DWARFUnit &SplitCU,
670670
DIEBuilder &DIEBlder,
671671
DebugRangesSectionWriter &TempRangesSectionWriter,
672-
DebugAddrWriter &AddressWriter) {
672+
DebugAddrWriter &AddressWriter,
673+
std::string &DWOName,
674+
std::optional<std::string> &DwarfOutputPath) {
673675
DIEBuilder DWODIEBuilder(BC, &(SplitCU).getContext(), DebugNamesTable,
674676
&Unit);
675677
DWODIEBuilder.buildDWOUnit(SplitCU);
676-
std::string DWOName = "";
677-
std::optional<std::string> DwarfOutputPath =
678-
opts::DwarfOutputPath.empty()
679-
? std::nullopt
680-
: std::optional<std::string>(opts::DwarfOutputPath.c_str());
681-
{
682-
std::lock_guard<std::mutex> Lock(AccessMutex);
683-
DWOName = DIEBlder.updateDWONameCompDir(
684-
*StrOffstsWriter, *StrWriter, Unit, DwarfOutputPath, std::nullopt);
685-
}
686678
DebugStrOffsetsWriter DWOStrOffstsWriter(BC);
687679
DebugStrWriter DWOStrWriter((SplitCU).getContext(), true);
688680
DWODIEBuilder.updateDWONameCompDirForTypes(
@@ -758,8 +750,16 @@ void DWARFRewriter::updateDebugInfo() {
758750
DebugRangesSectionWriter *TempRangesSectionWriter =
759751
CU->getVersion() >= 5 ? RangeListsWritersByCU[*DWOId].get()
760752
: LegacyRangesWritersByCU[*DWOId].get();
753+
std::string DWOName = "";
754+
std::optional<std::string> DwarfOutputPath =
755+
opts::DwarfOutputPath.empty()
756+
? std::nullopt
757+
: std::optional<std::string>(opts::DwarfOutputPath.c_str());
758+
std::lock_guard<std::mutex> Lock(AccessMutex);
759+
DWOName = DIEBlder.updateDWONameCompDir(*StrOffstsWriter, *StrWriter, *CU,
760+
DwarfOutputPath, std::nullopt);
761761
processSplitCU(*CU, **SplitCU, DIEBlder, *TempRangesSectionWriter,
762-
AddressWriter);
762+
AddressWriter, DWOName, DwarfOutputPath);
763763
}
764764
for (DWARFUnit *CU : DIEBlder.getProcessedCUs())
765765
processMainBinaryCU(*CU, DIEBlder);

0 commit comments

Comments
 (0)