summaryrefslogtreecommitdiff
path: root/bolt/lib/Core/DebugData.cpp
AgeCommit message (Collapse)Author
2025-10-16[BOLT] Replace LLVM_ATTRIBUTE_UNUSED with [[maybe_unused]] (NFC) (#163700)Kazu Hirata
This patch replaces LLVM_ATTRIBUTE_UNUSED with [[maybe_unused]], introduced as part of C++17.
2025-10-14[bolt] Fix typos discovered by codespell (#124726)Christian Clauss
https://github.com/codespell-project/codespell ```bash codespell bolt --skip="*.yaml,Maintainers.txt" --write-changes \ --ignore-words-list=acount,alledges,ans,archtype,defin,iself,mis,mmaped,othere,outweight,vas ```
2025-09-11[BOLT] Fix debug line emission for functions in multiple compilation units ↵Grigory Pastukhov
(#151230) This patch fixes a bug in BOLT's debug line emission where functions that belong to multiple compilation units (such as inline functions in header files) were not handled correctly. Previously, BOLT incorrectly assumed that a binary function could belong to only one compilation unit, leading to incomplete or incorrect debug line information. ### **Problem** When a function appears in multiple compilation units (common scenarios include): * Template instantiated functions * Inline functions defined in header files included by multiple source files BOLT would only emit debug line information for one compilation unit, losing debug information for other CUs where the function was compiled. This resulted in incomplete debugging information and could cause debuggers to fail to set breakpoints or show incorrect source locations. ### **Root Cause** The issue was in BOLT's assumption that each binary function maps to exactly one compilation unit. However, when the same function (e.g., an inline function from a header) is compiled into multiple object files, it legitimately belongs to multiple CUs in the final binary.
2025-05-17[BOLT] Remove unused local variables (NFC) (#140421)Kazu Hirata
While I'm at it, this patch removes GetExecutablePath, which becomes unused after removing the sole use.
2025-05-10[BOLT] Remove redundant calls to std::unique_ptr<T>::get (NFC) (#139403)Kazu Hirata
2024-07-26[BOLT][DWARF][NFC] Fix DebugStrOffsetsWriter (#100672)Sayhaan Siddiqui
Fix DebugStrOffsetsWriter so updateAddressMap can't be called after it is finalized.
2024-07-15[BOLT][DWARF][NFC] Refactor address writers (#98094)Sayhaan Siddiqui
Refactors address writers to create an instance for each CU and its DWO CU.
2024-07-10[BOLT][DWARF] Cleanup buffer initialization for DWO range writer (#97843)Sayhaan Siddiqui
Cleanup buffer initialization for DWO range writer instances to remove empty buffer at the beginning.
2024-07-09[BOLT][DWARF][NFC] Remove unnecessary SectionOffset (#97841)Sayhaan Siddiqui
Removes unnecessary SectionOffset variable from DebugData.
2024-07-03[BOLT][DWARF] Refactor legacy ranges writers (#96006)Sayhaan Siddiqui
Refactors legacy ranges writers to create a writer for each instance of a DWO file. We now write out everything into .debug_ranges after the all the DWO files are processed. This also changes the order that ranges is written out in, as before we wrote out while in the main CU processing loop and we now iterate through the CU buckets created by partitionCUs, after the main processing loop.
2024-05-14[BOLT][DWARF] Update DW_AT_comp_dir/DW_AT_dwo_name for DWO TUs (#91486)Alexander Yermolovich
Type unit DIE generated by clang contains DW_AT_comp_dir/DW_AT_dwo_name. This was added to clang to help LLDB to figure out where type unit come from when accessing an entry in a .debug_names accelerator table and type units in .dwp file. When BOLT writes out .dwo files it changes the name of them. User can also specify directory of where they can be written out. Added support to BOLT to update those attributes.
2024-03-31[BOLT][NFC] Clean includes, add license headers (#87200)Amir Ayupov
2024-02-21[BOLT][DWARF][NFC] Expose DebugStrOffsetsWriter::clear (#82548)Alexander Yermolovich
Refactored cod that clears data-structures in DebugStrOffsetsWriter into clear() function and made initialize() public. This is for https://github.com/llvm/llvm-project/pull/81062.
2024-02-14[BOLT][DWARF] Fix out of order rangelists/loclists (#81645)Alexander Yermolovich
GCC can generate rangelists/loclists that are out of order. Fixed so that we don't assert, and instead generate partially optimized list. Through most code paths we do sort rnglists/loclists, but not for loclist for a path where BOLT does not modify a function. Although it's nice to have lists sorted, this implementation shouldn't rely on it. This also fixes an issue if we partially capture a list we would write out *end_of_list in helper function. So tools won't see the rest of the addresses being written out.
2024-02-12[BOLT][NFC] Log through JournalingStreams (#81524)Amir Ayupov
Make core BOLT functionality more friendly to being used as a library instead of in our standalone driver llvm-bolt. To accomplish this, we augment BinaryContext with journaling streams that are to be used by most BOLT code whenever something needs to be logged to the screen. Users of the library can decide if logs should be printed to a file, no file or to the screen, as before. To illustrate this, this patch adds a new option `--log-file` that allows the user to redirect BOLT logging to a file on disk or completely hide it by using `--log-file=/dev/null`. Future BOLT code should now use `BinaryContext::outs()` for printing important messages instead of `llvm::outs()`. A new test log.test enforces this by verifying that no strings are print to screen once the `--log-file` option is used. In previous patches we also added a new BOLTError class to report common and fatal errors, so code shouldn't call exit(1) now. To easily handle problems as before (by quitting with exit(1)), callers can now use `BinaryContext::logBOLTErrorsAndQuitOnFatal(Error)` whenever code needs to deal with BOLT errors. To test this, we have fatal.s that checks we are correctly quitting and printing a fatal error to the screen. Because this is a significant change by itself, not all code was yet ported. Code from Profiler libs (DataAggregator and friends) still print errors directly to screen. Co-authored-by: Rafael Auler <rafaelauler@fb.com> Test Plan: NFC
2023-12-14[BOLT][DWARF] Fix handling .debug_str_offsets for type units (#75522)Alexander Yermolovich
There was an assumpiton that TUs and CUs share .debug_str_offsets contribution. For ThinLTO builds it is not the case. Changed so that we parse contributions for TUs also, and did some refactoring so that we don't re-parse contributions that were not modified.
2023-12-11[BOLT][DWARF] Fix handling of debug_str_offsets (#75100)Alexander Yermolovich
We were not setting size field of .debug_str_offsets correctly. Fixed it, and added a test.
2023-11-09[BOLT] Fix typos (#68121)spaette
Closes https://github.com/llvm/llvm-project/issues/63097 Before merging please make sure the change to bolt/include/bolt/Passes/StokeInfo.h is correct. bolt/include/bolt/Passes/StokeInfo.h ```diff // This Pass solves the two major problems to use the Stoke program without - // proting its code: + // probing its code: ``` I'm still not happy about the awkward wording in this comment. bolt/include/bolt/Passes/FixRelaxationPass.h ``` $ ed -s bolt/include/bolt/Passes/FixRelaxationPass.h <<<'9,12p' // This file declares the FixRelaxations class, which locates instructions with // wrong targets and fixes them. Such problems usually occures when linker // relaxes (changes) instructions, but doesn't fix relocations types properly // for them. $ ``` bolt/docs/doxygen.cfg.in bolt/include/bolt/Core/BinaryContext.h bolt/include/bolt/Core/BinaryFunction.h bolt/include/bolt/Core/BinarySection.h bolt/include/bolt/Core/DebugData.h bolt/include/bolt/Core/DynoStats.h bolt/include/bolt/Core/Exceptions.h bolt/include/bolt/Core/MCPlusBuilder.h bolt/include/bolt/Core/Relocation.h bolt/include/bolt/Passes/FixRelaxationPass.h bolt/include/bolt/Passes/InstrumentationSummary.h bolt/include/bolt/Passes/ReorderAlgorithm.h bolt/include/bolt/Passes/StackReachingUses.h bolt/include/bolt/Passes/StokeInfo.h bolt/include/bolt/Passes/TailDuplication.h bolt/include/bolt/Profile/DataAggregator.h bolt/include/bolt/Profile/DataReader.h bolt/lib/Core/BinaryContext.cpp bolt/lib/Core/BinarySection.cpp bolt/lib/Core/DebugData.cpp bolt/lib/Core/DynoStats.cpp bolt/lib/Core/Relocation.cpp bolt/lib/Passes/Instrumentation.cpp bolt/lib/Passes/JTFootprintReduction.cpp bolt/lib/Passes/ReorderData.cpp bolt/lib/Passes/RetpolineInsertion.cpp bolt/lib/Passes/ShrinkWrapping.cpp bolt/lib/Passes/TailDuplication.cpp bolt/lib/Rewrite/BoltDiff.cpp bolt/lib/Rewrite/DWARFRewriter.cpp bolt/lib/Rewrite/RewriteInstance.cpp bolt/lib/Utils/CommandLineOpts.cpp bolt/runtime/instr.cpp bolt/test/AArch64/got-ld64-relaxation.test bolt/test/AArch64/unmarked-data.test bolt/test/X86/Inputs/dwarf5-cu-no-debug-addr-helper.s bolt/test/X86/Inputs/linenumber.cpp bolt/test/X86/double-jump.test bolt/test/X86/dwarf5-call-pc-function-null-check.test bolt/test/X86/dwarf5-split-dwarf4-monolithic.test bolt/test/X86/dynrelocs.s bolt/test/X86/fallthrough-to-noop.test bolt/test/X86/tail-duplication-cache.s bolt/test/runtime/X86/instrumentation-ind-calls.s
2023-10-12Use llvm::endianness::{big,little,native} (NFC)Kazu Hirata
Note that llvm::support::endianness has been renamed to llvm::endianness while becoming an enum class as opposed to an enum. This patch replaces support::{big,little,native} with llvm::endianness::{big,little,native}.
2023-10-01[BOLT] Fix the initialization of DWARFDataExtractorKazu Hirata
Without this patch, we pass Endian as one of the parameters to the constructor of DWARFDataExtractor. The problem is that Endian is of: enum endianness {big, little, native}; whereas the constructor is expecting "bool IsLittleEndian". That is, we are relying on an implicit conversion to convert big and little to false and true, respectively. When we migrate llvm::support::endianness to std::endian in future, we can no longer rely on an implicit conversion because std::endian is declared with "enum class". Even if we could, the conversion would not be guaranteed to work because, for example, libcxx defines: enum class endian { little = 0xDEAD, big = 0xFACE, : where big and little are not boolean values. This patch fixes the problem by properly converting Endian to a boolean value.
2023-08-08[BOLT][DWARF][NFC] Remove addIndexAddressAlexander Yermolovich
Removed unused API DebugAddrWriter::addIndexAddress. Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D157357
2023-07-20[BOLT][DWARF] Fix performance regression running BOLT on binaries build with ↵Alexander Yermolovich
DWARF4 In one of the previous diffs LocBuffer was changed to pass by value. This lead to performance regression running BOLT on binaries with DWARF4 split dwarf. Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D155763
2023-07-10[BOLT][DWARF] Change to process and write out TUs first then CUs in batchesAlexander Yermolovich
To reduce memory footprint changed so that we process and write out TUs first, reset DIEBuilder and process CUs. CUs are processed in buckets. First bucket contains all the CUs with cross CU references. Rest processd one at a time. clang-17 build in debug mode, by clang-17. before 8:25.81 real, 834.37 user, 86.03 sys, 0 amem, 79525064 mmem 8:02.20 real, 820.46 user, 81.81 sys, 0 amem, 79501616 mmem 7:52.69 real, 802.01 user, 83.99 sys, 0 amem, 79534392 mmem after 7:49.35 real, 822.04 user, 66.19 sys, 0 amem, 34934260 mmem 7:42.16 real, 825.46 user, 63.52 sys, 0 amem, 34951660 mmem 7:46.71 real, 821.11 user, 63.14 sys, 0 amem, 34981164 mmem Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D151909
2023-07-10[BOLT][DWARF] Numerous fixes for a new DWARFRewriterAlexander Yermolovich
* Some cleanup and minor fixes for the new debug information re-writer before moving on to productatization. * The new rewriter wasn't handling binary with DWARF5 and DWARF4 with -fdebug-types-sections. * Removed dead cross cu reference code. * Added support for DW_AT_sibling. * With the new re-writer abbrev number can change which can lead to offset of Type Units changing. Before we would just copy raw data. Changed to write out Type Unit List. This is generated by gdb-add-index. * Fixed how bolt handles gdb-index generated by gdb-11 with types sections. Simplified logic that handles variations of gdb-index. * Clang can generate two type units with the same hash, but different content. LLD does not de-duplicate when ThinLTO is involved. Changed so that TU hash and offset are used to make TU's unique. * It is possible to have references within location expression to another DIE. Fixed it so that relative offset is updated correctly. * Removed all the code related to patching. * Removed dead code. Changed how we handling writting out TUs and TU Index. It now should fully work for DWARF4 and DWARF5. * Removed unused arguments from some APIs, changed return type to void, and other small cleanups. Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D151906
2023-07-10[BOLT][DWARF] Implement new mechanism for DWARFRewriterRui Zhong
This revision implement new mechanism for DWARFRewriter. In the new mechanism, we adopt the same way with DWARFLinker did. By parsing Debug information into IR, we are allowed to handle debug information more flexible. Now the debug information updating process relies on IR and IR will be written out to binary once the updating finished. A new class was added: DIEBuilder. This class is responsible for parsing debug information and raising it to the IR level. This class is also used to write out the .debug_info and .debug_abbrev sections. Since we output brand new Abbrev section we won't need to always convert low_pc/high_pc into ranges. When conversion does happen we can also remove low_pc entry. Reviewed By: maksfb, ayermolo Differential Revision: https://reviews.llvm.org/D130315
2023-07-09[BOLT] Fix unused-variable warningsKazu Hirata
This patch fixes: bolt/lib/Core/DebugData.cpp:1669:20: error: unused variable 'StrOffset' [-Werror,-Wunused-variable] bolt/lib/Core/DebugData.cpp:1676:18: error: unused variable 'NewOffset' [-Werror,-Wunused-variable]
2023-07-07Revert "[DWARF][BOLT] Implement new mechanism for DWARFRewriter"Nico Weber
This reverts commit 460a2244430fae192298a5fd9fa2a269e540e8c1. It breaks building on macOS, and it was landed with a review URL pointing to some Facebook-internal service. Also reverts a bunch of follow-ups: Revert "[BOLT][DWARF] Don't check string offsets" This reverts commit f9d6f48c8bf5acaac07502403c41cf0b0d89c8d2. Revert "[BOLT][DWARF] Change to process and write out TUs first then CUs in batches" This reverts commit 88e95c1e4bb6e2ad3bfd185b96341ad5c09eff6b. Revert "[BOLT][DWARF] Output DWO files as they are being processed" This reverts commit 46ca2e3fcd419b1246357ed3b9cd36630f16e64d. Revert "[BOLT][DWARF] Don't check string offsets" This reverts commit cfe4a4b04f219a9dbb4e3fc01883437b6ff0e702. Revert "[BOLT][DWARF] Numerous fixes for a new DWARFRewriter" This reverts commit 2701a661daa393ad5901ac88d420d7aa931eda0d.
2023-07-06[BOLT][DWARF] Change to process and write out TUs first then CUs in batchesAlexander Yermolovich
Summary: To reduce memory footprint changed so that we process and write out TUs first, reset DIEBuilder and process CUs. CUs are processed in buckets. First bucket contains all the CUs with cross CU references. Rest processd one at a time. clang-17 build in debug mode, by clang-17. before 8:25.81 real, 834.37 user, 86.03 sys, 0 amem, 79525064 mmem 8:02.20 real, 820.46 user, 81.81 sys, 0 amem, 79501616 mmem 7:52.69 real, 802.01 user, 83.99 sys, 0 amem, 79534392 mmem after 7:49.35 real, 822.04 user, 66.19 sys, 0 amem, 34934260 mmem 7:42.16 real, 825.46 user, 63.52 sys, 0 amem, 34951660 mmem 7:46.71 real, 821.11 user, 63.14 sys, 0 amem, 34981164 mmem Differential Revision: https://phabricator.intern.facebook.com/D45883198
2023-07-06[BOLT][DWARF] Numerous fixes for a new DWARFRewriterAlexander Yermolovich
Summary: * Some cleanup and minor fixes for the new debug information re-writer before moving on to productatization. * The new rewriter wasn't handling binary with DWARF5 and DWARF4 with -fdebug-types-sections. * Removed dead cross cu reference code. * Added support for DW_AT_sibling. * With the new re-writer abbrev number can change which can lead to offset of Type Units changing. Before we would just copy raw data. Changed to write out Type Unit List. This is generated by gdb-add-index. * Fixed how bolt handles gdb-index generated by gdb-11 with types sections. Simplified logic that handles variations of gdb-index. * Clang can generate two type units with the same hash, but different content. LLD does not de-duplicate when ThinLTO is involved. Changed so that TU hash and offset are used to make TU's unique. * It is possible to have references within location expression to another DIE. Fixed it so that relative offset is updated correctly. * Removed all the code related to patching. * Removed dead code. Changed how we handling writting out TUs and TU Index. It now should fully work for DWARF4 and DWARF5. * Removed unused arguments from some APIs, changed return type to void, and other small cleanups. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D46168257
2023-07-06[DWARF][BOLT] Implement new mechanism for DWARFRewriterAlexander Yermolovich
Summary: This revision implement new mechanism for DWARFRewriter. In the new mechanism, we adopt the same way with DWARFLinker did. By parsing Debug information into IR, we are allowed to handle debug information more flexible. Now the debug information updating process relies on IR and IR will be written out to binary once the updating finished. A new class was added: DIEBuilder. This class is responsible for parsing debug information and raising it to the IR level. This class is also used to write out the .debug_info and .debug_abbrev sections. Since we output brand new Abbrev section we won't need to always convert low_pc/high_pc into ranges. When conversion does happen we can also remove low_pc entry. Differential Revision: https://phabricator.intern.facebook.com/D39484421 Tasks: T117448832
2023-07-06[BOLT][DWARF] Fix for .debug_line with DWARF5Alexander Yermolovich
There was a bug in a code that pre-populated line string for a case where parts of .debug_line are not processed by BOLT, but copied as raw data. We were not switching sections. This resulted in parts of the binary being over-written with debug data. Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D154544
2023-06-15[BOLT] Move from RuntimeDyld to JITLinkJob Noorman
RuntimeDyld has been deprecated in favor of JITLink. [1] This patch replaces all uses of RuntimeDyld in BOLT with JITLink. Care has been taken to minimize the impact on the code structure in order to ease the inspection of this (rather large) changeset. Since BOLT relied on the RuntimeDyld API in multiple places, this wasn't always possible though and I'll explain the changes in code structure first. Design note: BOLT uses a JIT linker to perform what essentially is static linking. No linked code is ever executed; the result of linking is simply written back to an executable file. For this reason, I restricted myself to the use of the core JITLink library and avoided ORC as much as possible. RuntimeDyld contains methods for loading objects (loadObject) and symbol lookup (getSymbol). Since JITLink doesn't provide a class with a similar interface, the BOLTLinker abstract class was added to implement it. It was added to Core since both the Rewrite and RuntimeLibs libraries make use of it. Wherever a RuntimeDyld object was used before, it was replaced with a BOLTLinker object. There is one major difference between the RuntimeDyld and BOLTLinker interfaces: in JITLink, section allocation and the application of fixups (relocation) happens in a single call (jitlink::link). That is, there is no separate method like finalizeWithMemoryManagerLocking in RuntimeDyld. BOLT used to remap sections between allocating (loadObject) and linking them (finalizeWithMemoryManagerLocking). This doesn't work anymore with JITLink. Instead, BOLTLinker::loadObject accepts a callback that is called before fixups are applied which is used to remap sections. The actual implementation of the BOLTLinker interface lives in the JITLinkLinker class in the Rewrite library. It's the only part of the BOLT code that should directly interact with the JITLink API. For loading object, JITLinkLinker first creates a LinkGraph (jitlink::createLinkGraphFromObject) and then links it (jitlink::link). For the latter, it uses a custom JITLinkContext with the following properties: - Use BOLT's ExecutableFileMemoryManager. This one was updated to implement the JITLinkMemoryManager interface. Since BOLT never executes code, its finalization step is a no-op. - Pass config: don't use the default target passes since they modify DWARF sections in a way that seems incompatible with BOLT. Also run a custom pre-prune pass that makes sure sections without symbols are not pruned by JITLink. - Implement symbol lookup. This used to be implemented by BOLTSymbolResolver. - Call the section mapper callback before the final linking step. - Copy symbol values when the LinkGraph is resolved. Symbols are stored inside JITLinkLinker to ensure that later objects (i.e., instrumentation libraries) can find them. This functionality used to be provided by RuntimeDyld but I did not find a way to use JITLink directly for this. Some more minor points of interest: - BinarySection::SectionID: JITLink doesn't have something equivalent to RuntimeDyld's Section IDs. Instead, sections can only be referred to by name. Hence, SectionID was updated to a string. - There seem to be no tests for Mach-O. I've tested a small hello-world style binary but not more than that. - On Mach-O, JITLink "normalizes" section names to include the segment name. I had to parse the section name back from this manually which feels slightly hacky. [1] https://reviews.llvm.org/D145686#4222642 Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D147544
2023-05-03[BOLT][DWARF] Fix handling of loclists_base without location accessesAlexander Yermolovich
There are CUs that have DW_AT_loclists_base, but no DW_AT_location in children DIEs. Pre-bolt it points to a valid offset. We were not updating it, so it ended up pointing in the middle of a list and caused LLDB to print out errors. Changed it to point to first location list. I don't think it should matter since there are no accesses to it anyway. Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D149798
2023-04-13[BOLT][NFC] Fix UB due to unaligned load in DebugStrOffsetsWriterJob Noorman
The following tests fail when enabling UBSan due to an unaligned memory load: > runtime error: load of misaligned address 0x620000000643 for type > 'const uint32_t' (aka 'const unsigned int'), which requires 4 byte > alignment BOLT :: AArch64/asm-func-debug.test BOLT :: AArch64/update-debug-reloc.test BOLT :: X86/asm-func-debug.test BOLT :: X86/dwarf5-df-dualcu.test BOLT :: X86/dwarf5-df-mono-dualcu.test BOLT :: X86/dwarf5-ftypes-dwp-input-dwo-output.test BOLT :: X86/dwarf5-locaddrx.test BOLT :: X86/dwarf5-split-dwarf4-monolithic.test BOLT :: X86/inlined-function-mixed.test BOLT :: non-empty-debug-line.test This patch fixes this by using read32le for the load. Reviewed By: ayermolo Differential Revision: https://reviews.llvm.org/D148217
2023-02-06[BOLT][NFC] Replace anonymous namespace functions with staticAmir Ayupov
Follow LLVM Coding Standards guideline on using anonymous namespaces (https://llvm.org/docs/CodingStandards.html#anonymous-namespaces) and use `static` modifier for function definitions. Reviewed By: #bolt, maksfb Differential Revision: https://reviews.llvm.org/D143124
2023-01-24[BOLT][DWARF] Reuse entries in .debug_addr when not modifiedAlexander Yermolovich
In some binaries produced with ThinLTO there are CUs that share entry in .debug_addr. Before we would generate a new entry for each. Which lead to binary size increase. This changes the behavior so that we re-use entries in .debug_addr. Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D142425
2023-01-20[BOLT][DWARF] Change loclist encoding to use base_addrxAlexander Yermolovich
Doing the same thing as for rangelists. Changing loclists to use base_addrx, it slightly increases .debug_loclists, but reduces .debug_addr section. | section | clang-16.bolt.base | clang-16.bolt | raw | % | | debug_loclists | 198208 | 203398 | 5190 | 102% | | .debug_addr | 14415808 | 14351448 | -64360 |99.5% | Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D141969
2023-01-11[llvm][dwwarf] Change CU/TU index to 64-bitAlexander Yermolovich
Changed contribution data structure to 64 bit. I added the 32bit and 64bit accessors to make it explicit where we use 32bit and where we use 64bit. Also to make sure sure we catch all the cases where this data structure is used. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D139379
2023-01-11Revert "[llvm][dwwarf] Change CU/TU index to 64-bit"Alexander Yermolovich
This reverts commit fa3fa4d0d42326005dfd5887bf047b86904d3be6.
2023-01-10[llvm][dwwarf] Change CU/TU index to 64-bitAlexander Yermolovich
Changed contribution data structure to 64 bit. I added the 32bit and 64bit accessors to make it explicit where we use 32bit and where we use 64bit. Also to make sure sure we catch all the cases where this data structure is used. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D139379
2023-01-06[BOLT][DWARF] Change rangelists to use DW_RLE_offset_pairAlexander Yermolovich
Before we always used DW_RLE_startx_length. This is not very efficient and leads to bigger .debug_addr section. Changed it to use DW_RLE_base_addressx/DW_RLE_offset_pair. clang-16 build in debug mode llvm-bolt ran on it with --update-debug-sections | section | before | after | diff | % decrease | | .debug_rnglists | 32732292 | 31986051 | -746241 | 2.3% | | .debug_addr | 14415808 | 14184128 | -231680 | 1.6% | Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D140439
2023-01-03[BOLT][NFC] Use llvm::reverseAmir Ayupov
Use llvm::reverse instead of `for (auto I = rbegin(), E = rend(); I != E; ++I)` Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D140516
2022-12-07Revert "[llvm][dwwarf] Change CU/TU index to 64-bit"Alexander Yermolovich
This reverts commit 5ebd28f3e56c00a739fda46c72c9e0f6528add87.
2022-12-07[BOLT][DWARF] Don't create extra .debug_str_offsets contributionsAlexander Yermolovich
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. Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D139214
2022-12-07[llvm][dwwarf] Change CU/TU index to 64-bitAlexander Yermolovich
Summary: Changed contribution data structure to 64 bit. I added the 32bit and 64bit accessors to make it explicit where we use 32bit and where we use 64bit. Also to make sure sure we catch all the cases where this data structure is used.
2022-12-06[BOLT][NFC] Use std::optional for findAttributeInfoAmir Ayupov
LLVM started switching from `llvm::Optional` to `std::optional`: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716/11 Reviewed By: #bolt, maksfb Differential Revision: https://reviews.llvm.org/D139259
2022-12-05[DebugInfo] llvm::Optional => std::optionalFangrui Song
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-04[MC] llvm::Optional => std::optionalFangrui Song
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-02[BOLT] Use std::nullopt instead of None (NFC)Kazu Hirata
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-09-03[BOLT] Use range-based for loops (NFC)Kazu Hirata
LLVM Coding Standards discourage for_each unless callable objects already exist.