-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[BOLT][DWARF][NFC] Remove unnecessary SectionOffset #97841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D59175270
bolt/lib/Core/DebugData.cpp
Outdated
void DebugRangesSectionWriter::appendToRangeBuffer( | ||
const DebugBufferVector &CUBuffer) { | ||
*RangesStream << CUBuffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks duplicated and the function below still sets SectionOffset - can you please check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, was an error when rebasing and the old definition was included.
@llvm/pr-subscribers-bolt Author: Sayhaan Siddiqui (sayhaan) ChangesRemoves unnecessary SectionOffset variable from DebugData. Full diff: https://github.com/llvm/llvm-project/pull/97841.diff 2 Files Affected:
diff --git a/bolt/include/bolt/Core/DebugData.h b/bolt/include/bolt/Core/DebugData.h
index 144433ac78a37..cdcc8cd61f4fa 100644
--- a/bolt/include/bolt/Core/DebugData.h
+++ b/bolt/include/bolt/Core/DebugData.h
@@ -233,10 +233,6 @@ class DebugRangesSectionWriter {
std::mutex WriterMutex;
- /// Current offset in the section (updated as new entries are written).
- /// Starts with 16 since the first 16 bytes are reserved for an empty range.
- uint32_t SectionOffset{0};
-
/// Offset of an empty address ranges list.
static constexpr uint64_t EmptyRangesOffset{0};
diff --git a/bolt/lib/Core/DebugData.cpp b/bolt/lib/Core/DebugData.cpp
index 08d4c45aac791..579af3bce4eb8 100644
--- a/bolt/lib/Core/DebugData.cpp
+++ b/bolt/lib/Core/DebugData.cpp
@@ -138,8 +138,7 @@ DebugRangesSectionWriter::DebugRangesSectionWriter() {
RangesStream = std::make_unique<raw_svector_ostream>(*RangesBuffer);
// Add an empty range as the first entry;
- SectionOffset +=
- writeAddressRanges(*RangesStream.get(), DebugAddressRangesVector{});
+ writeAddressRanges(*RangesStream.get(), DebugAddressRangesVector{});
Kind = RangesWriterKind::DebugRangesWriter;
}
@@ -166,21 +165,20 @@ uint64_t DebugRangesSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
// Reading the SectionOffset and updating it should be atomic to guarantee
// unique and correct offsets in patches.
std::lock_guard<std::mutex> Lock(WriterMutex);
- const uint32_t EntryOffset = SectionOffset;
- SectionOffset += writeAddressRanges(*RangesStream.get(), Ranges);
+ const uint32_t EntryOffset = RangesBuffer->size();
+ writeAddressRanges(*RangesStream.get(), Ranges);
return EntryOffset;
}
uint64_t DebugRangesSectionWriter::getSectionOffset() {
std::lock_guard<std::mutex> Lock(WriterMutex);
- return SectionOffset;
+ return RangesBuffer->size();
}
void DebugRangesSectionWriter::appendToRangeBuffer(
const DebugBufferVector &CUBuffer) {
*RangesStream << CUBuffer;
- SectionOffset = RangesBuffer->size();
}
DebugAddrWriter *DebugRangeListsSectionWriter::AddrWriter = nullptr;
@@ -327,7 +325,6 @@ void DebugRangeListsSectionWriter::finalizeSection() {
*RangesStream << *Header;
*RangesStream << *CUArrayBuffer;
*RangesStream << *CUBodyBuffer;
- SectionOffset = RangesBuffer->size();
}
void DebugRangeListsSectionWriter::initSection(DWARFUnit &Unit) {
|
Removes unnecessary SectionOffset variable from DebugData.
Removes unnecessary SectionOffset variable from DebugData.