aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData
AgeCommit message (Collapse)AuthorFilesLines
3 hours[Support] Deprecate one form of support::endian::byte_swap (NFC) (#161045)Kazu Hirata4-13/+13
This is a follow-up to #156140 and #160979, which deprecated one form of write and read, respectively. We have two forms of byte_swap: template <typename value_type> [[nodiscard]] inline value_type byte_swap(value_type value, endianness endian) template <typename value_type, endianness endian> [[nodiscard]] inline value_type byte_swap(value_type value) The difference is that endian is a function parameter in the former but a template parameter in the latter. This patch streamlines the code by migrating the use of the latter to the former while deprecating the latter because the latter is just forwarded to the former.
29 hours[Support] Deprecate one form of support::endian::read (NFC) (#160979)Kazu Hirata2-6/+6
This is a follow-up to #156140, which deprecated one form of write. We have two forms of read: template <typename value_type, std::size_t alignment> [[nodiscard]] inline value_type read(const void *memory, endianness endian) template <typename value_type, endianness endian, std::size_t alignment> [[nodiscard]] inline value_type read(const void *memory) The difference is that endian is a function parameter in the former but a template parameter in the latter. This patch streamlines the code by migrating the use of the latter to the former while deprecating the latter.
2025-09-12[SampleFDO][TypeProf]Support vtable type profiling for ext-binary and text ↵Mingming Liu3-7/+233
format (#148002) This change extends SampleFDO ext-binary and text format to record the vtable symbols and their counts for virtual calls inside a function. The vtable profiles will allow the compiler to annotate vtable types on IR instructions and perform vtable-based indirect call promotion. An RFC is in https://discourse.llvm.org/t/rfc-vtable-type-profiling-for-samplefdo/87283 Given a function below, the before vs after of a function's profile is illustrated in text format in the table: ``` __attribute__((noinline)) int loop_func(int i, int a, int b) { Base *ptr = createType(i); int sum = ptr->func(a, b); delete ptr; return sum; } ``` | before | after | | --- | --- | | Samples collected in the function's body { <br> 0: 636241 <br> 1: 681458, calls: _Z10createTypei:681458 <br> 3: 543499, calls: _ZN12_GLOBAL__N_18Derived24funcEii:410621 _ZN8Derived14funcEii:132878 <br> 5.1: 602201, calls: _ZN12_GLOBAL__N_18Derived2D0Ev:454635 _ZN8Derived1D0Ev:147566 <br> 7: 511057 <br> } | Samples collected in the function's body { <br> 0: 636241 <br> 1: 681458, calls: _Z10createTypei:681458 <br> 3: 543499, calls: _ZN12_GLOBAL__N_18Derived24funcEii:410621 _ZN8Derived14funcEii:132878 <br> 3: vtables: _ZTV8Derived1:1377 _ZTVN12_GLOBAL__N_18Derived2E:4250 <br> 5.1: 602201, calls: _ZN12_GLOBAL__N_18Derived2D0Ev:454635 _ZN8Derived1D0Ev:147566 <br> 5.1: vtables: _ZTV8Derived1:227 _ZTVN12_GLOBAL__N_18Derived2E:765 <br> 7: 511057 <br> } | Key points for this change: 1. In-memory representation of vtable profiles * A field of type `map<LineLocation, map<FunctionId, uint64_t>>` is introduced in a function's in-memory representation [FunctionSamples](https://github.com/llvm/llvm-project/blob/ccc416312ed72e92a885425d9cb9c01f9afa58eb/llvm/include/llvm/ProfileData/SampleProf.h#L749-L754). 2. The vtable counters for one LineLocation represents the relative frequency among vtables for this LineLocation. They are not required to be comparable across LineLocations. 3. For backward compatibility of ext-binary format, we take one bit from ProfSummaryFlag as illustrated in the enum class `SecProfSummaryFlags`. The ext-binary profile reader parses the integer type flag and reads this bit. If it's set, the profile reader will parse vtable profiles. 4. The vtable profiles are optional in ext-binary format, and not serialized out by default, we introduce an LLVM boolean option (named `-extbinary-write-vtable-type-prof`). The ext-binary profile writer reads the boolean option and decide whether to set the section flag bit and serialize the in-memory class members corresponding to vtables. 5. This change doesn't implement `llvm-profdata overlap --sample` for the vtable profiles. A subsequent change will do it to keep this one focused on the profile format change. We don't plan to add the vtable support to non-extensible format mainly because of the maintenance cost to keep backward compatibility for prior versions of profile data. * Currently, the [non-extensible binary format](https://github.com/llvm/llvm-project/blob/5c28af409978c19a35021855a29dcaa65e95da00/llvm/lib/ProfileData/SampleProfWriter.cpp#L899-L900) does not have feature parity with extensible binary format today, for instance, the former doesn't support [profile symbol list](https://github.com/llvm/llvm-project/blob/41e22aa31b1905aa3e9d83c0343a96ec0d5187ec/llvm/include/llvm/ProfileData/SampleProf.h#L1518-L1522) or context-sensitive PGO, both of which give measurable performance boost. Presumably the non-extensible format is not in wide use. --------- Co-authored-by: Paschalis Mpeis <paschalis.mpeis@arm.com>
2025-08-23[NFC][SampleFDO] Re-apply "In text sample prof reader, report more concrete ↵Mingming Liu1-4/+11
parsing errors for different line types" (#155124) Re-apply https://github.com/llvm/llvm-project/pull/154885 with a fix to initialize `LineTy` before calling `ParseLine`.
2025-08-23Revert "[NFC][SampleFDO] In text sample prof reader, report dreport more ↵Mingming Liu1-10/+3
concrete parsing errors for different line types" (#155121) Reverts llvm/llvm-project#154885 to fix build bot failure (https://lab.llvm.org/buildbot/#/builders/144/builds/33611)
2025-08-23[NFC][SampleFDO] In text sample prof reader, report dreport more concrete ↵Mingming Liu1-3/+10
parsing errors for different line types (#154885) The format `'NUM[.NUM]: NUM[ mangled_name:NUM]*'` applies for most line types except metadata ones.
2025-08-23[ProfileData] Fix typo in profile overlap message (NFC)Yi Kong1-1/+1
Corrects an "infomation" -> "information" typo in the summary message printed by `llvm-profdata overlap`.
2025-08-17[llvm] Remove unused includes (NFC) (#154051)Kazu Hirata1-1/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-08-13[nfc][pgo] `const`-ify some APIs in `InstrProfSymtab` (#153284)Mircea Trofin2-3/+3
The main reason some `const` - sounding APIs weren't const was because their state is lazily updated (ensuring ordering).
2025-08-08[InstrProf] Fix trace reservoir sampling (#152563)Ellis Hoag1-45/+18
`InstrProfWriter::addTemporalProfileTraces()` did not correctly account for when the sources traces are sampled, but the reservoir size is larger than what it was before, meaning there is room for more traces. Also, if the reservoir size decreased, meaning traces should be truncated. Depends on https://github.com/llvm/llvm-project/pull/152550 for the test refactor
2025-08-05[ProfileData] Remove an unnecessary cast (NFC) (#152087)Kazu Hirata1-2/+1
new already returns ValueProfData *.
2025-07-30[MemProf] Write out raw profile bytes in little endian. (#150375)Snehasish Kumar1-2/+33
Instead of writing out in native endian, write out the raw profile bytes in little endian. Also update the MIB data in little endian. Also clean up some lint and unused includes in rawprofile.cpp.
2025-07-30Reapply "[MemProf] Change histogram storage from uint64_t to uint16_t… ↵Snehasish Kumar1-10/+28
(#151431) Reapply #147854 after fixes merged in #151398. Change memory access histogram storage from uint64_t to uint16_t to reduce profile size on disk. This change updates the raw profile format to v5. Also add a histogram test in compiler-rt since we didn't have one before. With this change the histogram memprof raw for the basic test reduces from 75KB -> 20KB.
2025-07-30Revert "[MemProf] Change histogram storage from uint64_t to uint16_t" (#151382)Snehasish Kumar1-28/+10
Reverts llvm/llvm-project#147854 Test failure when building with gcc. https://lab.llvm.org/buildbot/#/builders/174/builds/21989
2025-07-30[MemProf] Change histogram storage from uint64_t to uint16_t (#147854)Snehasish Kumar1-10/+28
Change memory access histogram storage from uint64_t to uint16_t to reduce profile size on disk. This change updates the raw profile format to v5. Also add a histogram test in compiler-rt since we didn't have one before. With this change the histogram memprof raw for the basic test reduces from 75KB -> 20KB.
2025-07-24[ProfileData] Remove an unnecessary cast (NFC) (#150472)Kazu Hirata1-1/+1
getBufferEnd() already returns const char *.
2025-07-12[ProfileData] Remove an unnecessary cast (NFC) (#148341)Kazu Hirata1-1/+1
getBufferStart() already returns const char *.
2025-07-09[NFC]Codestyle changes for SampleFDO library (#147840)Mingming Liu3-17/+22
* Introduce an error code for illegal_line_offset in sampleprof_error namespace, and use it for line offset parsing error. * Add `const` for `LineLocation::serialize`. * Use structured binding, make_first/second_range in loops. I'm working on a [sample-profile format change](https://github.com/llvm/llvm-project/compare/users/mingmingl-llvm/samplefdo-profile-format) to extend SampleFDO profile with vtable profiles. And this change splits the non-functional changes.
2025-07-01[ProfileData] Use lambdas instead of std::bind (NFC) (#146625)Kazu Hirata1-12/+8
Lambdas are a lot shorter than std::bind here.
2025-06-27Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… ↵Sterling-Augustine2-1/+2
(#145959) (#146112) Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (#145959) This reapplies cbf781f0bdf2f680abbe784faedeefd6f84c246e, with fixes for the shared-library build and the unconventional sanitizer-runtime build. Original Description: This is the culmination of a series of changes described in [1]. Although somewhat large by line count, it is almost entirely mechanical, creating a new library in DebugInfo/DWARF/LowLevel. This new library has very minimal dependencies, allowing it to be used from more places than the normal DebugInfo/DWARF library--in particular from MC. 1. https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2
2025-06-26Revert "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… ↵Sterling-Augustine2-2/+1
(#145959) …145081)" This reverts commit cbf781f0bdf2f680abbe784faedeefd6f84c246e. Breaks a couple of buildbots.
2025-06-26[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#145081)Sterling-Augustine2-1/+2
This is the culmination of a series of changes described in [1]. Although somewhat large by line count, it is almost entirely mechanical, creating a new library in DebugInfo/DWARF/LowLevel. This new library has very minimal dependencies, allowing it to be used from more places than the normal DebugInfo/DWARF library--in particular from MC. I am happy to put it in another location, or to structure it differently if that makes sense. Some have suggested in BinaryFormat, but it is not a great fit there. But if that makes more sense to the reviewers, I can do that. Another possibility would be to use pass-through headers to allow clients who don't care to depend only on DebugInfo/DWARF. This would be a much less invasive change, and perhaps easier for clients. But also a system that hides details. Either way, I'm open. 1. https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2
2025-06-25[NFC][PGO] Use constants rather than free strings for metadata labels (#145721)Mircea Trofin1-2/+3
2025-06-24[InstrProf] Factor out getRecord() and use NamedInstrProfRecord (#145417)Ellis Hoag1-3/+3
Factor out code in `populateCounters()` and `populateCoverage()` used to grab the record into `PGOUseFunc::getRecord()` to reduce code duplication. And return `NamedInstrProfRecord` in `getInstrProfRecord()` to avoid an unnecessary cast. No functional change is intented.
2025-06-20[llvm-cov][gcov] Support multi-files coverage in one basic block (#144504)int-zjt1-19/+26
In the current gcov implementation, all lines within a basic block are attributed to the source file of the block's containing function. This is inaccurate when a block contains lines from other files (e.g., via #include "foo.inc"). Commit [406e81b](https://github.com/llvm/llvm-project/commit/406e81b79d26dae6838cc69d10a3e22635da09ef) attempted to address this by filtering lines based on debug info types, but this approach has two limitations: * **Over-filtering**: Some valid lines belonging to the function are incorrectly excluded. * **Under-counting**: Lines not belonging to the function are filtered out and omitted from coverage statistics. **GCC Reference Behavior** GCC's gcov implementation handles this case correctly.This change aligns the LLVM behavior with GCC. **Proposed Solution** 1. **GCNO Generation**: * **Current**: Each block stores a single GCOVLines record (filename + lines). * **New**: Dynamically create new GCOVLines records whenever consecutive lines in a block originate from different source files. Group subsequent lines from the same file under one record. 2. **GCNO Parsing**: * **Current**: Lines are directly attributed to the function's source file. * **New**: Introduce a GCOVLocation type to track filename/line mappings within blocks. Statistics will reflect the actual source file for each line.
2025-06-13Reland "[llvm-cov] Add support for baseline coverage" (#144130)Fabian Meumertzheim1-48/+75
When no profile is provided, but the new --empty-profile option is specified, the export/report/show commands now emit coverage data equivalent to that obtained from a profile with all zero counters ("baseline coverage"). This is useful for build systems (e.g. Bazel) that can track coverage information for each build target, even those that are never linked into tests and thus don't have runtime coverage data recorded. By merging in baseline coverage, lines in files that aren't linked into tests are correctly reported as uncovered. Reland with fixes to `CoverageMappingTest.cpp`. Reverts llvm/llvm-project#144121
2025-06-13Revert "[llvm-cov] Add support for baseline coverage" (#144121)Keith Smiley1-75/+48
Reverts llvm/llvm-project#117910 ``` /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/ProfileData/CoverageMappingTest.cpp /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/ProfileData/CoverageMappingTest.cpp:281:28: error: 'std::reference_wrapper' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported] 281 | std::make_optional(std::reference_wrapper(*ProfileReader)); | ^ /usr/lib/gcc/ppc64le-redhat-linux/8/../../../../include/c++/8/bits/refwrap.h:289:11: note: add a deduction guide to suppress this warning 289 | class reference_wrapper | ^ ```
2025-06-13[llvm-cov] Add support for baseline coverage (#117910)Fabian Meumertzheim1-48/+75
When no profile is provided, but the new --empty-profile option is specifed, the export/report/show commands now emit coverage data equivalent to that obtained from a profile with all zero counters ("baseline coverage"). This is useful for build systems (e.g. Bazel) that can track coverage information for each build target, even those that are never linked into tests and thus don't have runtime coverage data recorded. By merging in baseline coverage, lines in files that aren't linked into tests are correctly reported as uncovered.
2025-06-12[llvm][MemProf] Correct position of LLVM_ABI macro in computeFrameHistogramDavid Spickett1-8/+8
The previous placement resulted in this warning when using g++-13: /home/david.spickett/llvm-project/llvm/include/llvm/Support/Compiler.h:120:43: warning: attribute ignored [-Wattributes] 120 | #define LLVM_ATTRIBUTE_VISIBILITY_DEFAULT [[gnu::visibility("default")]] | ^ /home/david.spickett/llvm-project/llvm/include/llvm/Support/Compiler.h:213:18: note: in expansion of macro ‘LLVM_ATTRIBUTE_VISIBILITY_DEFAULT’ 213 | #define LLVM_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/david.spickett/llvm-project/llvm/lib/ProfileData/MemProfRadixTree.cpp:245:5: note: in expansion of macro ‘LLVM_ABI’ 245 | LLVM_ABI computeFrameHistogram<FrameId>( | ^~~~~~~~ /home/david.spickett/llvm-project/llvm/include/llvm/Support/Compiler.h:120:43: note: an attribute that appertains to a type-specifier is ignored 120 | #define LLVM_ATTRIBUTE_VISIBILITY_DEFAULT [[gnu::visibility("default")]] | ^ According to the interface guide, that macro should go before the return type to be effective. https://llvm.org/docs/InterfaceExportAnnotations.html#specialized-template-functions
2025-06-10[llvm] annotate interfaces in llvm/ProfileData for DLL export (#142861)Andrew Rogers2-12/+14
## Purpose This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/ProfileData` library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build. ## Background This effort is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst). The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`. The following manual adjustments were also applied after running IDS on Linux: - Manually annotate the file `llvm/include/llvm/ProfileData/InstrProfData.inc` because it is skipped by IDS - Add `LLVM_TEMPLATE_ABI` and `LLVM_EXPORT_TEMPLATE` to exported instantiated templates. - Add `LLVM_ABI_FRIEND` to friend member functions declared with `LLVM_ABI` - Add `LLVM_ABI` to a small number of symbols that require export but are not declared in headers ## Validation Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: - Windows with MSVC - Windows with Clang - Linux with GCC - Linux with Clang - Darwin with Clang
2025-06-04[llvm] Remove unused includes (NFC) (#142733)Kazu Hirata2-3/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-05-29[MemProf] Summary section cleanup (NFC) (#142003)Teresa Johnson6-74/+91
Address post-commit review comments from PR141805. Misc cleanup but the biggest changes are moving some common utilities to new MemProfCommon files to reduce unnecessary includes.
2025-05-28[MemProf] Add basic summary section support (#141805)Teresa Johnson6-14/+239
This patch adds support for a basic MemProf summary section, which is built along with the indexed MemProf profile (e.g. when reading the raw or YAML profiles), and serialized through the indexed profile just after the header. Currently only 6 fields are written, specifically the number of contexts (total, cold, hot), and the max context size (cold, warm, hot). To support forwards and backwards compatibility for added fields in the indexed profile, the number of fields serialized first. The code is written to support forwards compatibility (reading newer profiles with additional summary fields), and comments indicate how to implement backwards compatibility (reading older profiles with fewer summary fields) as needed. Support is added to print the summary as YAML comments when displaying both the raw and indexed profiles via `llvm-profdata show`. Because they are YAML comments, the YAML reader ignores these (the summary is always recomputed when building the indexed profile as described above). This necessitated moving some options and a couple of interfaces out of Analysis/MemoryProfileInfo.cpp and into the new ProfileData/MemProfSummary.cpp file, as we need to classify context hotness earlier and also compute context ids to build the summary from older indexed profiles.
2025-05-27[NFCI]Add SampleRecord::serialize and LineLocation::serialize to simplify ↵Mingming Liu2-13/+28
FunctionSamples serialization (#141669)
2025-05-27[NFCI] Clean up idempotent stack pop for inline context (#141544)Mingming Liu1-3/+0
In the top-of-tree, the stack pops at L414-416 [1] are no-op since there are prior stack pops at L400-402. [1] https://github.com/llvm/llvm-project/blame/e015626f189dc76f8df9fdc25a47638c6a2f3feb/llvm/lib/ProfileData/SampleProfReader.cpp#L414-L416 [2] https://github.com/llvm/llvm-project/blame/e015626f189dc76f8df9fdc25a47638c6a2f3feb/llvm/lib/ProfileData/SampleProfReader.cpp#L400-L402
2025-05-27[NFCI]Print LineLocation using its print method to simplify the code. (#141545)Mingming Liu1-10/+4
2025-05-24Re-apply "[StaticDataLayout][PGO]Implement reader and writer change for data ↵Mingming Liu5-17/+108
access profiles" (#141275) Re-apply https://github.com/llvm/llvm-project/pull/139997 after fixing the use-of-uninitialized-memory error (https://lab.llvm.org/buildbot/#/builders/94/builds/7373). Tested: The error is reproduced with https://github.com/llvm/llvm-zorg/blob/main/zorg/buildbot/builders/sanitizers/buildbot_bootstrap_msan.sh without the fix, and test pass with the fix. **Original commit message:** https://github.com/llvm/llvm-project/pull/138170 introduces classes to operate on data access profiles. This change supports the read and write of `DataAccessProfData` in indexed format of MemProf (v4) as well as its the text (yaml) format. For indexed format: * InstrProfWriter owns (by `std::unique_ptr<DataAccessProfData>`) the data access profiles, and gives a non-owned copy when it calls `writeMemProf`. * MemProf v4 header has a new `uint64_t` to record the byte offset of data access profiles. This `uint64_t` field is zero if data access profile is not set (nullptr). * MemProfReader reads the offset from v4 header and de-serializes in-memory bytes into class `DataAccessProfData`. For textual format: * MemProfYAML.h adds the mapping for DAP class, and make DAP optional for both read and write. 099a0fa (by @snehasish) introduces v4 which contains CalleeGuids in CallSiteInfo, and this change changes the v4 format in place with data access profiles. The current plan is to bump the version and enable v4 profiles with both features, assuming waiting for this change won't delay the callsite change too long. --------- Co-authored-by: Kazu Hirata <kazu@google.com>
2025-05-22Revert "[StaticDataLayout][PGO]Implement reader and writer change for data ↵Mingming Liu5-108/+17
access profiles" (#141157) Reverts llvm/llvm-project#139997 Sanitizer failures (https://lab.llvm.org/buildbot/#/builders/94/builds/7373) Will fix forward later.
2025-05-22[StaticDataLayout][PGO]Implement reader and writer change for data access ↵Mingming Liu5-17/+108
profiles (#139997) https://github.com/llvm/llvm-project/pull/138170 introduces classes to operate on data access profiles. This change supports the read and write of `DataAccessProfData` in indexed format of MemProf (v4) as well as its the text (yaml) format. For indexed format: * InstrProfWriter owns (by `std::unique_ptr<DataAccessProfData>`) the data access profiles, and gives a non-owned copy when it calls `writeMemProf`. * MemProf v4 header has a new `uint64_t` to record the byte offset of data access profiles. This `uint64_t` field is zero if data access profile is not set (nullptr). * MemProfReader reads the offset from v4 header and de-serializes in-memory bytes into class `DataAccessProfData`. For textual format: * MemProfYAML.h adds the mapping for DAP class, and make DAP optional for both read and write. 099a0fa (by @snehasish) introduces v4 which contains CalleeGuids in CallSiteInfo, and this change changes the v4 format in place with data access profiles. The current plan is to bump the version and enable v4 profiles with both features, assuming waiting for this change won't delay the callsite change too long. --------- Co-authored-by: Kazu Hirata <kazu@google.com>
2025-05-20Revert "[llvm][NFC] Use `llvm::sort()`" (#140668)Iris Shi1-1/+1
2025-05-19[ProfileData] Restore Core as a dependency for the ProfileData library (#140650)Snehasish Kumar1-0/+1
#140505 dropped the dependency on core but it's still needed as indicated by the failing dynamically linked builds.
2025-05-19[NFC][MemProf] Move types shared between Analysis, ProfileData and ↵Snehasish Kumar1-1/+0
ModuleSummary (Core) to a separate header (#140505) Part of a larger refactoring with the following goals 1. Reduce the size of MemProf.h 2. Avoid including ModuleSummaryIndex just for a couple of types
2025-05-19[NFC][MemProf] Move IndexedMemProfData to its own header. (#140503)Snehasish Kumar2-14/+0
Part of a larger refactoring with the following goals 1. Reduce the size of MemProf.h 2. Avoid including ModuleSummaryIndex just for a couple of types
2025-05-19[NFC][MemProf] Move getGUID out of IndexedMemProfRecord (#140502)Snehasish Kumar2-3/+2
Part of a larger refactoring with the following goals 1. Reduce the size of MemProf.h 2. Avoid including ModuleSummaryIndex just for a couple of types
2025-05-19[NFC][MemProf] Move Radix tree methods to their own header and cpp. (#140501)Snehasish Kumar5-236/+256
Part of a larger refactoring with the following goals 1. Reduce the size of MemProf.h 2. Avoid including ModuleSummaryIndex just for a couple of types
2025-05-17[ProfileData] Use DenseMap::try_emplace (NFC) (#140394)Kazu Hirata1-8/+2
We can simplify the code with structured binding and try_emplace. Note that try_emplace default-constructs the value if omitted. FWIW, structured binding, a C++17 feature, wasn't available in our codebase at the time the code was written.
2025-05-17[llvm][NFC] Use `llvm::sort()` (#140335)Iris Shi1-1/+1
2025-05-15[StaticDataLayout][PGO] Add profile format for static data layout, and the ↵Mingming Liu3-6/+268
classes to operate on the profiles. (#138170) Context: For https://discourse.llvm.org/t/rfc-profile-guided-static-data-partitioning/83744#p-336543-background-3, we propose to profile memory loads and stores via hardware events, symbolize the addresses of binary static data sections and feed the profile back into compiler for data partitioning. This change adds the profile format for static data layout, and the classes to operate on it. The profile and its format 1. Conceptually, a piece of data (call it a symbol) is represented by its symbol name or its content hash. The former applies to majority of data whose mangled name remains relatively stable over binary releases, and the latter applies to string literals (with name patterns like `.str.<N>[.llvm.<hash>]`. - The symbols with samples are hot data. The number of hot symbols is small relative to all symbols. The profile tracks its sampled counts and locations. Sampled counts come from hardware events, and locations come from debug information in the profiled binary. The symbols without samples are cold data. The number of such cold symbols is large. The profile tracks its representation (the name or content hash). - Based on a preliminary study, debug information coverage for data symbols is partial and best-effort. In the LLVM IR, global variables with source code correspondence may or may not have debug information. Therefore the location information is optional in the profiles. 2. The profile-and-compile cycle is similar to SamplePGO. Profiles are sampled from production binaries, and used in next binary releases. Known cold symbols and new hot symbols can both have zero sampled counts, so the profile records known cold symbols to tell the two for next compile. In the profile's serialization format, strings are concatenated together and compressed. Individual records stores the index. A separate PR will connect this class to InstrProfReader/Writer via MemProfReader/Writer. --------- Co-authored-by: Kazu Hirata <kazu@google.com>
2025-05-15[NFC] One-liner clang-format (#140104)Mingming Liu1-3/+1
`InstrProfWriter::setOutputSparse` gets re-formatted when InstrProfWriter.cpp is modified. So formatted this line.
2025-05-12[llvm] Use llvm::find_if (NFC) (#139654)Kazu Hirata1-2/+2