[llvm] [BOLT][DWARF] Avoid unnecessary work if DWO id is zero (PR #154749)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 21 05:38:11 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-bolt
Author: Jinjie Huang (Jinjie-Huang)
<details>
<summary>Changes</summary>
DWOs with a DWOId of 0 are considered invalid. Currently, createRangeLocListAddressWriters() is called before these invalid DWOs are skipped, which seems unnecessary. Perhaps we can check the DWOId beforehand?
BTW, this may lead to an assertion failure inside createRangeLocListAddressWriters("RangeLists writer for DWO unit already exists.), when a duplicate DWO ID of 0 is encountered. I hit this case when using the compiler built prior to this [commit](https://github.com/llvm/llvm-project/commit/e731a2678c7cf81b1d3817489a52b519cb14f85e) with -fsplit-dwarf-inlining enabled, which generates a large number of Compile Units with a DWO ID == 0. I'm not sure if other scenarios could also trigger this issue.
---
Full diff: https://github.com/llvm/llvm-project/pull/154749.diff
1 Files Affected:
- (modified) bolt/lib/Rewrite/DWARFRewriter.cpp (+1-1)
``````````diff
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index 0c1a1bac6c72e..e8f6189eb5a69 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -729,13 +729,13 @@ void DWARFRewriter::updateDebugInfo() {
ThreadPoolInterface &ThreadPool =
ParallelUtilities::getThreadPool(ThreadCount);
for (DWARFUnit *CU : DIEBlder.getProcessedCUs()) {
- createRangeLocListAddressWriters(*CU);
std::optional<DWARFUnit *> SplitCU;
std::optional<uint64_t> DWOId = CU->getDWOId();
if (DWOId)
SplitCU = BC.getDWOCU(*DWOId);
if (!SplitCU)
continue;
+ createRangeLocListAddressWriters(*CU);
DebugAddrWriter &AddressWriter =
*AddressWritersByCU[CU->getOffset()].get();
DebugRangesSectionWriter &TempRangesSectionWriter =
``````````
</details>
https://github.com/llvm/llvm-project/pull/154749
More information about the llvm-commits
mailing list