[llvm] [BOLT][DWARF] Avoid unnecessary work if DWO id is zero (PR #154749)
Jinjie Huang via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 21 06:03:06 PDT 2025
https://github.com/Jinjie-Huang updated https://github.com/llvm/llvm-project/pull/154749
>From 7e2e637573f0d3805685e34b49373ccd8aa82324 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Thu, 21 Aug 2025 21:02:25 +0800
Subject: [PATCH] Avoid unnecessary work if DWO id is zero
---
bolt/lib/Rewrite/DWARFRewriter.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index 0c1a1bac6c72e..e867a02d9da42 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -620,7 +620,8 @@ void DWARFRewriter::updateDebugInfo() {
LocListWritersByCU[CUIndex] =
std::make_unique<DebugLoclistWriter>(CU, DwarfVersion, false, *AddrW);
- if (std::optional<uint64_t> DWOId = CU.getDWOId()) {
+ if (std::optional<uint64_t> DWOId = CU->getDWOId();
+ DWOId && *DWOId != 0) {
assert(RangeListsWritersByCU.count(*DWOId) == 0 &&
"RangeLists writer for DWO unit already exists.");
auto DWORangeListsSectionWriter =
@@ -635,7 +636,8 @@ void DWARFRewriter::updateDebugInfo() {
std::make_unique<DebugAddrWriter>(&BC, CU.getAddressByteSize());
AddressWritersByCU[CU.getOffset()] = std::move(AddrW);
LocListWritersByCU[CUIndex] = std::make_unique<DebugLocWriter>();
- if (std::optional<uint64_t> DWOId = CU.getDWOId()) {
+ if (std::optional<uint64_t> DWOId = CU->getDWOId();
+ DWOId && *DWOId != 0) {
assert(LegacyRangesWritersByCU.count(*DWOId) == 0 &&
"LegacyRangeLists writer for DWO unit already exists.");
auto LegacyRangesSectionWriterByCU =
More information about the llvm-commits
mailing list