Skip to content

Commit a972b2e

Browse files
authored
[BOLT][DWARF][NFC] Cleanup RangesBase check (llvm#97840)
Moves check for RangesBase under check for UnitDie. This makes the flow clearer because we add RangesBase when it is a UnitDie.
1 parent 6299681 commit a972b2e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

bolt/lib/Rewrite/DWARFRewriter.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -2161,21 +2161,21 @@ void DWARFRewriter::convertToRangesPatchDebugInfo(
21612161
DIEBldr.replaceValue(&Die, LowPCAttrInfo.getAttribute(),
21622162
LowPCAttrInfo.getForm(), DIEInteger(0));
21632163
}
2164-
}
2165-
// Original CU didn't have DW_AT_*_base. We converted it's children (or
2166-
// dwo), so need to insert it into CU.
2167-
if (RangesBase) {
2168-
if (Unit.getVersion() >= 5) {
2169-
DIEBldr.addValue(&Die, RangeBaseAttribute, dwarf::DW_FORM_sec_offset,
2170-
DIEInteger(*RangesBase));
2171-
} else {
2172-
DIEBldr.addValue(&Die, RangeBaseAttribute, dwarf::DW_FORM_sec_offset,
2173-
DIEInteger(INT_MAX));
2174-
auto RangesWriterIterator =
2175-
LegacyRangesWritersByCU.find(*Unit.getDWOId());
2176-
assert(RangesWriterIterator != LegacyRangesWritersByCU.end() &&
2177-
"RangesWriter does not exist for DWOId");
2178-
RangesWriterIterator->second->setDie(&Die);
2164+
// Original CU didn't have DW_AT_*_base. We converted it's children (or
2165+
// dwo), so need to insert it into CU.
2166+
if (RangesBase) {
2167+
if (Unit.getVersion() >= 5) {
2168+
DIEBldr.addValue(&Die, RangeBaseAttribute, dwarf::DW_FORM_sec_offset,
2169+
DIEInteger(*RangesBase));
2170+
} else {
2171+
DIEBldr.addValue(&Die, RangeBaseAttribute, dwarf::DW_FORM_sec_offset,
2172+
DIEInteger(INT_MAX));
2173+
auto RangesWriterIterator =
2174+
LegacyRangesWritersByCU.find(*Unit.getDWOId());
2175+
assert(RangesWriterIterator != LegacyRangesWritersByCU.end() &&
2176+
"RangesWriter does not exist for DWOId");
2177+
RangesWriterIterator->second->setDie(&Die);
2178+
}
21792179
}
21802180
}
21812181

0 commit comments

Comments
 (0)