This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][DWARF] Don't create extra .debug_str_offsets contributions
ClosedPublic

Authored by ayermolo on Dec 2 2022, 10:55 AM.

Details

Summary

With ThinLTO mutliple CUs can share the same .debug_str_offsets contribution. We
were creating a new one for each CU. This lead to a binary size increase.

Diff Detail

Event Timeline

ayermolo created this revision.Dec 2 2022, 10:55 AM
Herald added a reviewer: Amir. · View Herald Transcript
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
ayermolo requested review of this revision.Dec 2 2022, 10:55 AM
maksfb added inline comments.Dec 5 2022, 11:55 AM
bolt/include/bolt/Core/DebugData.h
447

Use DenseSet<>.

bolt/lib/Core/DebugData.cpp
1095

Is this an assert on internal condition or is it the input validation?

1110–1111

When can this happen?

bolt/test/X86/dwarf5-shared-str-offset-base.s
12

Perhaps include the source files since they appear to be short and how .s was generated.

13
291
ayermolo marked 3 inline comments as done.Dec 6 2022, 4:45 PM
ayermolo added inline comments.
bolt/lib/Core/DebugData.cpp
1095

Internal state. In case this somehow gets called in DWARF4 or something.

1110–1111

In theory, if two DWO CUs share same entry (built with ThinLTO). From what I have seen they do not, since compilation directory is different, but who knows in the future.

ayermolo updated this revision to Diff 480712.Dec 6 2022, 5:13 PM

addressed comments

ayermolo updated this revision to Diff 480714.Dec 6 2022, 5:21 PM

updated error message

ayermolo updated this revision to Diff 480721.Dec 6 2022, 5:31 PM

addressed comments

ayermolo marked 2 inline comments as done.Dec 6 2022, 5:32 PM
maksfb accepted this revision.Dec 6 2022, 5:33 PM

LGTM

This revision is now accepted and ready to land.Dec 6 2022, 5:33 PM
ayermolo updated this revision to Diff 481005.Dec 7 2022, 12:05 PM

clang-format

ayermolo updated this revision to Diff 481017.Dec 7 2022, 12:40 PM

s/Optional/std::optional to work with trunk