summaryrefslogtreecommitdiff
path: root/llvm/unittests/CodeGen/DIEHashTest.cpp
AgeCommit message (Collapse)Author
2023-02-10[NFC][TargetParser] Replace uses of llvm/Support/Host.hArchibald Elliott
The forwarding header is left in place because of its use in `polly/lib/External/isl/interface/extract_interface.cc`, but I have added a GCC warning about the fact it is deprecated, because it is used in `isl` from where it is included by Polly.
2022-07-08[DWARF] Add linkagename to hashAlexander Yermolovich
Originally encountered with RUST, but also there are cases with distributed LTO where debug info dwo units contain structurally the same debug information, with difference in DW_AT_linkage_name. This causes collision on DWO ID. Differential Revision: https://reviews.llvm.org/D129317
2022-06-05[Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef - remove isIndexed().Alexey Lapshin
This patch is extraction from the https://reviews.llvm.org/D126883. It removes DwarfStringPoolEntryRef::isIndexed() and isIndexed bit since they are not used. Differential Revision: https://reviews.llvm.org/D126958
2021-05-21[unittests][CodeGen] Mark tests that cannot be executed with GTEST_SKIP()Igor Kudrin
This helps to distinguish such tests from successfully passed ones. Differential Revision: https://reviews.llvm.org/D102754
2020-09-17[DebugInfo] Simplify DIEInteger::SizeOf().Igor Kudrin
An AsmPrinter should always be provided to the method because some forms depend on its parameters. The only place in the codebase which passed a nullptr value was found in the unit tests, so the patch updates it to use some dummy AsmPrinter instead. Differential Revision: https://reviews.llvm.org/D85293
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-08-07[DebugInfo] Reduce debug_str_offsets section sizePavel Labath
Summary: The accelerator tables use the debug_str section to store their strings. However, they do not support the indirect method of access that is available for the debug_info section (DW_FORM_strx et al.). Currently our code is assuming that all strings can/will be referenced indirectly, and puts all of them into the debug_str_offsets section. This is generally true for regular (unsplit) dwarf, but in the DWO case, most of the strings in the debug_str section will only be used from the accelerator tables. Therefore the contents of the debug_str_offsets section will be largely unused and bloating the main executable. This patch rectifies this by teaching the DwarfStringPool to differentiate between strings accessed directly and indirectly. When a user inserts a string into the pool it has to declare whether that string will be referenced directly or not. If at least one user requsts indirect access, that string will be assigned an index ID and put into debug_str_offsets table. Otherwise, the offset table is skipped. This approach reduces the overall binary size (when compiled with -gdwarf-5 -gsplit-dwarf) in my tests by about 2% (debug_str_offsets is shrunk by 99%). Reviewers: probinson, dblaikie, JDevlieghere Subscribers: aprantl, mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D49493 llvm-svn: 339122
2017-06-07Move Object format code to lib/BinaryFormat.Zachary Turner
This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
2017-06-06Re-sort #include lines for unittests. This uses a slightly modifiedChandler Carruth
clang-format (https://reviews.llvm.org/D33932) to keep primary headers at the top and handle new utility headers like 'gmock' consistently with other utility headers. No other change was made. I did no manual edits, all of this is clang-format. This should allow other changes to have more clear and focused diffs, and is especially motivated by moving some headers into more focused libraries. llvm-svn: 304786
2016-07-13Fix header comment in unittests/CodeGen/DIEHashTest.cpp.Justin Lebar
llvm-svn: 275296
2015-06-25AsmPrinter: Use an intrusively linked list for DIE::ChildrenDuncan P. N. Exon Smith
Replace the `std::vector<>` for `DIE::Children` with an intrusively linked list. This is a strict memory improvement: it requires no auxiliary storage, and reduces `sizeof(DIE)` by one pointer. It also factors out the DIE-related malloc traffic. This drops llc memory usage from 735 MB down to 718 MB, or ~2.3%. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 240736
2015-06-25AsmPrinter: Convert DIE::Values to a linked listDuncan P. N. Exon Smith
Change `DIE::Values` to a singly linked list, where each node is allocated on a `BumpPtrAllocator`. In order to support `push_back()`, the list is circular, and points at the tail element instead of the head. I abstracted the core list logic out to `IntrusiveBackList` so that it can be reused for `DIE::Children`, which also cares about `push_back()`. This drops llc memory usage from 799 MB down to 735 MB, about 8%. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 240733
2015-05-27Reapply "AsmPrinter: Change DIEValue to be stored by value"Duncan P. N. Exon Smith
This reverts commit r238350, effectively reapplying r238349 after fixing (all?) the problems, all somehow related to how I was using `AlignedArrayCharUnion<>` inside `DIEValue`: - MSVC can only handle `sizeof()` on types, not values. Change the assert. - GCC doesn't know the `is_trivially_copyable` type trait. Instead of asserting it, add destructors. - Call placement new even when constructing POD (i.e., the pointers). - Instead of copying the char buffer, copy the casted classes. I've left in a couple of `static_assert`s that I think both MSVC and GCC know how to handle. If the bots disagree with me, I'll remove them. - Check that the constructed type is either standard layout or a pointer. This protects against a programming error: we really want the "small" `DIEValue`s to be small and simple, so don't accidentally change them not to be. - Similarly, check that the size of the buffer is no bigger than a `uint64_t` or a pointer. (I thought checking against `sizeof(uint64_t)` would be good enough, but Chandler suggested that pointers might sometimes be bigger than that in the context of sanitizers.) I've also committed r238359 in the meantime, which introduces a DIEValue.def to simplify dispatching between the various types (thanks to a review comment by David Blaikie). Without that, this commit would be almost unintelligible. Here's the original commit message: -- Change `DIEValue` to be stored/passed/etc. by value, instead of reference. It's now a discriminated union, with a `Val` field storing the actual type. The classes that used to inherit from `DIEValue` no longer do. There are two categories of these: - Small values fit in a single pointer and are stored by value. - Large values require auxiliary storage, and are stored by reference. The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp. It was relying on `DIEInteger`s being passed around by reference, so I replaced that assumption with a `PatchLocation` type that stores a safe reference to where the `DIEInteger` lives instead. This commit causes a temporary regression in memory usage, since I've left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit. I measured an increase from 845 MB to 879 MB, around 3.9%. The follow-up drops it lower than the starting point, and I've only recently brought the memory this low anyway, so I'm committing these changes separately to keep them incremental. (I also considered swapping the commits, but the other one first would cause a lot more code churn.) (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) -- llvm-svn: 238362
2015-05-27Revert "AsmPrinter: Change DIEValue to be stored by value"Duncan P. N. Exon Smith
This reverts commit r238349, since it caused some errors on bots: - std::is_trivially_copyable isn't available until GCC 5.0. - It was complaining about strict aliasing with my use of ArrayCharUnion. llvm-svn: 238350
2015-05-27AsmPrinter: Change DIEValue to be stored by valueDuncan P. N. Exon Smith
Change `DIEValue` to be stored/passed/etc. by value, instead of reference. It's now a discriminated union, with a `Val` field storing the actual type. The classes that used to inherit from `DIEValue` no longer do. There are two categories of these: - Small values fit in a single pointer and are stored by value. - Large values require auxiliary storage, and are stored by reference. The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp. It was relying on `DIEInteger`s being passed around by reference, so I replaced that assumption with a `PatchLocation` type that stores a safe reference to where the `DIEInteger` lives instead. This commit causes a temporary regression in memory usage, since I've left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit. I measured an increase from 845 MB to 879 MB, around 3.9%. The follow-up drops it lower than the starting point, and I've only recently brought the memory this low anyway, so I'm committing these changes separately to keep them incremental. (I also considered swapping the commits, but the other one first would cause a lot more code churn.) (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 238349
2015-05-24AsmPrinter: Make DIEString smallDuncan P. N. Exon Smith
Expose the `DwarfStringPool` entry in a header, and store a pointer to it directly in `DIEString`. Instead of choosing at creation time how to emit it, use the `dwarf::Form` to determine that at emission time. Besides avoiding the other `DIEValue`, this shaves two pointers off of `DIEString`; the data is now a single pointer. This is a nice cleanup on its own -- and drops memory usage from 861 MB down to 853 MB, around 0.9% -- but it's also preparation for passing `DIEValue`s by value. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 238117
2015-01-14[cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth
utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
2015-01-05Make DIE.h a public CodeGen header.Frederic Riss
dsymutil would like to use all the AsmPrinter/MCStreamer infrastructure to stream out the DWARF. In order to do so, it will reuse the DIE object and so this header needs to be public. The interface exposed here has some corners that cannot be used without a DwarfDebug object, but clients that want to stream Dwarf can just avoid these. Differential Revision: http://reviews.llvm.org/D6695 llvm-svn: 225208
2014-04-25DIE: Pass ownership of children via std::unique_ptr rather than raw pointer.David Blaikie
This should reduce the chance of memory leaks like those fixed in r207240. There's still some unclear ownership of DIEs happening in DwarfDebug. Pushing unique_ptr and references through more APIs should help expose the cases where ownership is a bit fuzzy. llvm-svn: 207263
2014-04-25DIEEntry: Refer to the specified DIE via reference rather than pointer.David Blaikie
Makes some more cases (the unit tests, specifically), lexically compatible with a change to unique_ptr. llvm-svn: 207261
2014-04-25PR19554: Fix some memory leaks in DIEHashTest.cppDavid Blaikie
llvm-svn: 207240
2014-02-20Add support for hashing attributes with DW_FORM_block. This requiredEric Christopher
passing down an AsmPrinter instance so we could compute the size of the block which could be target specific. All of the test cases in the unittest don't have any target specific data so we can use a NULL AsmPrinter there. This also depends upon block data being added as integers. We can now hash the entire fission-cu.ll compile unit so turn the flag on there with the hash value. llvm-svn: 201752
2014-02-20This tests DW_FORM_sdata, not DW_FORM_block. Make the test say so.Eric Christopher
llvm-svn: 201749
2014-02-20Fix commit thinkos from splitting out patches.Eric Christopher
llvm-svn: 201748
2014-02-20Add support for hashing DW_FORM_sdata and a small testcase.Eric Christopher
llvm-svn: 201747
2014-02-20Format.Eric Christopher
llvm-svn: 201746
2014-01-31Add support for DW_FORM_flag and DW_FORM_flag_present to the DIE hashingEric Christopher
algorithm. Sink the 'A' + Attribute hash into each form so we don't have to check valid forms before deciding whether or not we're going to hash which will let the default be to return without doing anything. llvm-svn: 200571
2014-01-31Fix name of nested type in comment to match code.Eric Christopher
llvm-svn: 200570
2014-01-07Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth
subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
2013-10-25DIEHash: Summary hashing of member functionsDavid Blaikie
llvm-svn: 193432
2013-10-25DIEHash: Summary hashing of nested typesDavid Blaikie
llvm-svn: 193427
2013-10-24DIEHash: Const correct and use references where non-null/non-rebound.David Blaikie
llvm-svn: 193363
2013-10-24DIEHash: Do not use shallow type hashing for unnamed typesDavid Blaikie
llvm-svn: 193361
2013-10-22DWARF type hashing: pointers to membersDavid Blaikie
Includes a test case/FIXME demonstrating a bug/limitation in pointer to member hashing. To be honest I'm not sure why we don't just always use summary hashing for referenced types... but perhaps I'm missing something. llvm-svn: 193175
2013-10-21DWARF Type Hashing: Include reference and rvalue reference type in the ↵David Blaikie
declarable summary hashing path More support for 7.25 Part 5. llvm-svn: 193129
2013-10-21DWARF type hashing: begin implementing Step 5, summary hashing in declarable ↵David Blaikie
contexts There are several other tag types that need similar handling but to ensure test coverage they'll be coming incrementally. llvm-svn: 193126
2013-10-21DIEHashTest: Correct the order of operands to the TEST macroDavid Blaikie
And add the 'Test' suffix so the test case name matches the file name. llvm-svn: 193119
2013-10-21DWARF type hashing: Handle multiple (including recursive) references to the ↵David Blaikie
same type This uses a map, keeping the type DIE numbering separate from the DIEs themselves - alternatively we could do things the way GCC does if we want to add an integer to the DIE type to record the numbering there. llvm-svn: 193105
2013-10-17DIEHash: Support for simple (non-recursive, non-reused) type referencesDavid Blaikie
llvm-svn: 192924
2013-10-17DIEHash: Include the type's context in the type hash.David Blaikie
llvm-svn: 192856
2013-10-16DIEHash: Use DW_FORM_sdata for integers, per spec.David Blaikie
This allows us to produce the same hash as GCC for at least some simple examples. llvm-svn: 192855
2013-10-16Invert arguments to ASSERT_EQ to match gtest diagnostic printingDavid Blaikie
GTest assumes the left hand side of the assert is the expectation and the right hand side is the test result. It's easier to read gtest failures when these things are ordered correctly. llvm-svn: 192854
2013-10-16DIEHash: Include the trailing zero byte after the children of a DIEDavid Blaikie
llvm-svn: 192836
2013-10-15Use ASSERT_EQ rather than ASSERT_TRUE for better unit test failures.David Blaikie
Also minor using namespace move so it's not hard-up against the function definition and outside the namespace as is usual. llvm-svn: 192744
2013-09-29Plug a memory leak in a unit test. Stack allocation is sufficient here.Benjamin Kramer
llvm-svn: 191638
2013-09-04It's a very large constant. Say so.Eric Christopher
llvm-svn: 189899
2013-09-03Add a hashing routine that handles hashing types. Add a test forEric Christopher
hashing the contents of DW_FORM_data1 on top of a type with attributes. llvm-svn: 189862