From d90b02be7e80ba9b83506d635909ccba7f9038d1 Mon Sep 17 00:00:00 2001 From: Nexlab-One Date: Sun, 9 Aug 2026 13:01:31 +0200 Subject: [PATCH 1/2] Support LLVM 23 raw profile format (version 11) LLVM 23 bumped INSTR_PROF_RAW_VERSION to 11 and changed two structures, so v11 .profraw files are misparsed. The visible symptom is a `Nom(Satisfy)` parser failure preceded by "consistency check for reading counts failed". Three changes are needed, and the third is easy to miss: 1. The raw header gains three uint64 fields before NamesSize: NumUniformCounters, PaddingBytesAfterUniformCounters, UniformCountersDelta. Without reading them, every later field is off by 24 bytes -- notably counters_delta, which read_raw_counts uses for offset arithmetic, which is what trips the consistency check. 2. The per-function ProfileData record gains UniformCounterPtr (after CounterPtr) and OffloadDeviceWaveSize (a uint16 after NumValueSites[]). 3. The struct tail padding MOVED. In v9/v10 ProfileData ends on a 4-byte field at offset 60 so C pads to 64 -- which is what the existing `take(4)` in parse_bytes compensates for (answering its "TODO WHAT AM I MISSING HERE?": it is struct tail padding). In v11 OffloadDeviceWaveSize pushes NumBitmapBytes to offset 68, the struct ends at 72 which is already 8-aligned, so there is no tail padding and the 2 padding bytes move INSIDE the struct instead. Taking 4 there as well over-consumes and desynchronises every record after the first. Verified end to end against a real v11 profraw from rustc 1.99.0-nightly (LLVM 23.1.0): the header and both ProfileData records now decode correctly, and `cargo tarpaulin --engine llvm` reports 100.00% coverage, 1/1 lines on a one-function crate -- matching what the ptrace engine independently reports. Refs #81 --- src/instrumentation_profile/raw_profile.rs | 52 ++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/src/instrumentation_profile/raw_profile.rs b/src/instrumentation_profile/raw_profile.rs index 2ae86fc..3b88500 100644 --- a/src/instrumentation_profile/raw_profile.rs +++ b/src/instrumentation_profile/raw_profile.rs @@ -71,6 +71,10 @@ pub struct Header { pub bitmap_delta: u64, pub num_vtables: u64, pub vnames_size: u64, + /// Raw profile version 11 (LLVM 23) added uniform-counter fields. + pub num_uniform_counters: u64, + pub padding_bytes_after_uniform_counters: u64, + pub uniform_counters_delta: u64, } impl Header { @@ -119,12 +123,16 @@ pub struct ProfileData { name_ref: u64, func_hash: u64, counter_ptr: T, + /// Raw profile version 11 (LLVM 23). + uniform_counter_ptr: Option, bitmap_ptr: Option, function_addr: T, values_ptr_expr: T, num_counters: u32, /// This might just be two values? num_value_sites: [u16; ValueKind::MemOpSize as usize + 1], + /// Raw profile version 11 (LLVM 23). + offload_device_wave_size: u16, num_bitmap_bytes: u32, } @@ -232,7 +240,7 @@ where || counter_offset > max_counters || counter_offset + data.num_counters as i64 > max_counters { - error!("consistency check for reading counts failed"); + error!("consistency check for reading counts failed"); //Err(Err::Failure(Error::new(bytes, ErrorKind::Satisfy))) TODO Err(Err::Failure(VerboseError::from_error_kind( bytes, @@ -343,8 +351,13 @@ where let (bytes, data) = ProfileData::::parse(input, &header)?; debug!("Parsed data section {:?}", data); data_section.push(data); - if version_num > 8 { - let (bytes, v) = take(4usize)(bytes)?; // TODO WHAT AM I MISSING HERE? + // Struct tail padding. In v9/v10 ProfileData ends on a 4-byte field at offset 60, + // so the compiler pads to 64. In v11 (LLVM 23) OffloadDeviceWaveSize shifts + // NumBitmapBytes to offset 68, the struct ends at 72 which is already 8-aligned, + // and the padding moves INSIDE the struct (2 bytes, handled in ProfileData::parse). + // Taking 4 here as well would over-consume and desynchronise every later record. + if version_num > 8 && version_num < 11 { + let (bytes, v) = take(4usize)(bytes)?; debug!("Got those padding? bytes {:?}", v); input = bytes; } else { @@ -478,6 +491,18 @@ where (bytes, 0, 0) }; + // Raw profile version 11 (LLVM 23) inserts three uint64 fields here, before + // NamesSize. Without reading them every subsequent field is off by 24 bytes. + let (bytes, num_uniform_counters, padding_bytes_after_uniform_counters, uniform_counters_delta) = + if (version & !VARIANT_MASKS_ALL) >= 11 { + let (bytes, num_uniform_counters) = nom_u64(endianness)(bytes)?; + let (bytes, padding_after) = nom_u64(endianness)(bytes)?; + let (bytes, uniform_delta) = nom_u64(endianness)(bytes)?; + (bytes, num_uniform_counters, padding_after, uniform_delta) + } else { + (bytes, 0, 0, 0) + }; + let (bytes, names_len) = nom_u64(endianness)(bytes)?; let (bytes, counters_delta) = nom_u64(endianness)(bytes)?; @@ -517,6 +542,9 @@ where bitmap_delta, num_vtables, vnames_size, + num_uniform_counters, + padding_bytes_after_uniform_counters, + uniform_counters_delta, }; debug!("Read header {:?}", result); Ok((bytes, result)) @@ -554,6 +582,13 @@ where let (bytes, name_ref) = nom_u64(endianness)(bytes)?; let (bytes, func_hash) = nom_u64(endianness)(bytes)?; let (bytes, counter_ptr) = parse(bytes)?; + // v11 (LLVM 23) inserts UniformCounterPtr between CounterPtr and BitmapPtr. + let (bytes, uniform_counter_ptr) = if header.version() >= 11 { + let (bytes, p) = parse(bytes)?; + (bytes, Some(p)) + } else { + (bytes, None) + }; let (bytes, bitmap_ptr) = if header.version() > 8 { let (bytes, bitmap_ptr) = parse(bytes)?; (bytes, Some(bitmap_ptr)) @@ -565,6 +600,15 @@ where let (bytes, num_counters) = nom_u32(endianness)(bytes)?; let (bytes, value_0) = nom_u16(endianness)(bytes)?; let (bytes, value_1) = nom_u16(endianness)(bytes)?; + // v11 (LLVM 23) adds OffloadDeviceWaveSize after NumValueSites[]. In C that leaves the + // following uint32 misaligned, so the compiler inserts 2 bytes of padding; skip both. + let (bytes, offload_device_wave_size) = if header.version() >= 11 { + let (bytes, w) = nom_u16(endianness)(bytes)?; + let (bytes, _pad) = nom_u16(endianness)(bytes)?; + (bytes, w) + } else { + (bytes, 0) + }; let (bytes, num_bitmap_bytes) = if header.version() > 8 { nom_u32(endianness)(bytes)? } else { @@ -577,11 +621,13 @@ where name_ref, func_hash, counter_ptr, + uniform_counter_ptr, bitmap_ptr, function_addr, values_ptr_expr, num_counters, num_value_sites: [value_0, value_1], + offload_device_wave_size, num_bitmap_bytes, }, )) From 72007917ae7b31f29fb23fe4a8991b5be47a7e6b Mon Sep 17 00:00:00 2001 From: Nexlab-One <86677687+Nexlab-One@users.noreply.github.com> Date: Sun, 9 Aug 2026 23:40:03 +0200 Subject: [PATCH 2/2] Skip the uniform counter section, and add LLVM 23 test vectors Addresses the review feedback on #82. The header change alone was not enough. compiler-rt writes the body as data, PaddingBytesBeforeCounters, counters, PaddingBytesAfterCounters, bitmap, PaddingBytesAfterBitmapBytes, uniform counters, PaddingBytesAfterUniformCounters, names (the IOVec list in lprofWriteDataImpl). parse_bytes stopped at the end of PaddingBytesAfterCounters and went straight to names, so with a non-empty uniform counter section the names parser starts reading inside the counter payload. In practice it does not produce garbage names, it panics: the first thing it reads there is a length prefix, and an arbitrary 8 bytes of counter data is a very large length. range end index 197877615 out of range for slice of length 90 The same gap applied to the bitmap section, which sits immediately before the uniform counters and was also never skipped, so both are handled together. Both are zero-sized in the common case, which is why this went unnoticed. The bitmap is only populated for MC/DC instrumentation and NumUniformCounters is 0 unless the uniform counter section is emitted, so the arithmetic is a no-op on an ordinary profile. Because both sections are normally empty, a profile captured from a normal build cannot exercise this. tests/data/profdata/misc/v11_uniform_counters.profraw is a real v11 profraw from rustc 1.99.0-nightly (771916f90 2026-08-08), LLVM 23.1.0, with two uniform counters spliced in and the three v11 header fields set to match. Reverting the skip and rerunning v11_uniform_counter_section_is_skipped reproduces the panic above; with the skip in place both symbol names decode. Test vectors, as requested: tests/data/profdata/llvm-23 is populated from llvm/test/tools/llvm-profdata/Inputs at release/23.x, commit d8145e71418fb1e0a936adfb07dc5317113fc3b6. Filtering to the extensions llvm-22 carries gives 98 files, the same count and per-extension breakdown as llvm-22 (72 proftext, 9 profdata, 9 memprofraw, 4 profraw, and one each of v1, v2, v4, v10). Downloaded through the API and base64 decoded rather than over raw HTTP, since this was fetched on Windows and the binary vectors must not go through newline translation. All 22 binary vectors (profraw, profdata, memprofraw) were then checked back against their upstream blob SHAs and every one is byte identical. The committed proftext files are LF in the index, matching upstream. Also adds the __llvm_23 feature, the (23, nightly-2026-08-08) entry in SUPPORTED_LLVM_VERSIONS, and moves LATEST_SUPPORTED_VERSION to 23. CI runs --all-features so it picks the new feature up without a workflow change. Verification, on Windows x86_64: cargo test --release --test profdata v11_uniform_counter_section_is_skipped 1 passed, and FAILED with the panic above when the skip is reverted the rest of cargo test --release is unchanged from before this commit: merge, show_profdatas, show_proftexts and show_profraws fail identically because cargo profdata is unavailable here, everything else passes cargo profdata could not be used to drive the integration tests in this environment. cargo-binutils 0.4.0 panics inside clap on any cargo profdata -- invocation, so the harness cannot shell out to it. As a substitute I ran llvm-profdata from the nightly toolchain directly over the new vectors and compared it against profparser show for each file, matching on hash, counter count, function count and block counts. Of the 13 binary vectors, 4 are accepted by llvm-profdata and all 4 agree exactly; the other 9 are rejected by llvm-profdata itself, which is expected for a directory that deliberately contains malformed and older-format inputs. So the new directory is verified against LLVM's own tool, but not yet through the repository's own harness on this machine. One thing worth flagging: thinlto_indirect_call_promotion.profraw hits an unimplemented!() in raw_profile.rs when parsed directly. That is not new here, the same vector is already in tests/data/profdata/llvm-22, and llvm-profdata rejects it too so check_command skips it. The uniform counter values themselves are still read and discarded rather than surfaced, which remains the open question from the original description. cargo fmt --check is clean. It was not clean before this commit: the earlier v11 header work left three spots unformatted in raw_profile.rs, including an error! call that lost four spaces of indentation relative to master. Those are fixed here rather than left for CI. --- Cargo.toml | 1 + src/instrumentation_profile/raw_profile.rs | 54 +++++++-- .../profdata/llvm-23/CSIR_profile.proftext | 11 ++ tests/data/profdata/llvm-23/FUnique.proftext | 30 +++++ .../data/profdata/llvm-23/IR_profile.proftext | 9 ++ .../data/profdata/llvm-23/NoFUnique.proftext | 30 +++++ tests/data/profdata/llvm-23/bad-hash.proftext | 4 + tests/data/profdata/llvm-23/bar3-1.proftext | 6 + .../llvm-23/basic-histogram.memprofraw | Bin 0 -> 20256 bytes tests/data/profdata/llvm-23/basic.memprofraw | Bin 0 -> 1152 bytes tests/data/profdata/llvm-23/basic.profraw | Bin 0 -> 192 bytes tests/data/profdata/llvm-23/basic.proftext | 19 ++++ .../data/profdata/llvm-23/basic_v3.memprofraw | Bin 0 -> 880 bytes .../data/profdata/llvm-23/basic_v4.memprofraw | Bin 0 -> 1152 bytes .../data/profdata/llvm-23/buildid.memprofraw | Bin 0 -> 1152 bytes tests/data/profdata/llvm-23/c-general.profraw | Bin 0 -> 2152 bytes .../profdata/llvm-23/clang_profile.proftext | 8 ++ .../data/profdata/llvm-23/compat.profdata.v1 | Bin 0 -> 792 bytes .../data/profdata/llvm-23/compat.profdata.v10 | Bin 0 -> 872 bytes .../data/profdata/llvm-23/compat.profdata.v2 | Bin 0 -> 712 bytes .../data/profdata/llvm-23/compat.profdata.v4 | Bin 0 -> 1336 bytes .../data/profdata/llvm-23/compressed.profraw | Bin 0 -> 2104 bytes .../llvm-23/counter-mismatch-1.proftext | 13 +++ .../llvm-23/counter-mismatch-2.proftext | 5 + .../llvm-23/counter-mismatch-3.proftext | 6 + .../llvm-23/counter-mismatch-4.proftext | 7 ++ .../cs-sample-preinline-probe.proftext | 48 ++++++++ .../llvm-23/cs-sample-preinline.proftext | 40 +++++++ .../data/profdata/llvm-23/cs-sample.proftext | 38 +++++++ tests/data/profdata/llvm-23/cs.proftext | 10 ++ tests/data/profdata/llvm-23/cutoff.proftext | 21 ++++ tests/data/profdata/llvm-23/empty.proftext | 0 .../data/profdata/llvm-23/extra-word.proftext | 2 + tests/data/profdata/llvm-23/fe-basic.proftext | 6 + .../profdata/llvm-23/flatten_instr.proftext | 32 ++++++ .../profdata/llvm-23/flatten_sample.proftext | 12 ++ tests/data/profdata/llvm-23/foo3-1.proftext | 6 + tests/data/profdata/llvm-23/foo3-2.proftext | 6 + .../data/profdata/llvm-23/foo3bar3-1.proftext | 13 +++ .../llvm-23/function-entry-coverage.profdata | Bin 0 -> 816 bytes .../llvm-23/header-directives-1.proftext | 8 ++ .../llvm-23/header-directives-2.proftext | 8 ++ .../llvm-23/header-directives-3.proftext | 10 ++ tests/data/profdata/llvm-23/inline.memprofraw | Bin 0 -> 976 bytes .../profdata/llvm-23/instr-remap.proftext | 25 +++++ .../llvm-23/invalid-count-later.proftext | 4 + tests/data/profdata/llvm-23/ir-basic.proftext | 6 + .../data/profdata/llvm-23/mix_instr.proftext | 25 +++++ .../profdata/llvm-23/mix_instr_small.proftext | 18 +++ .../data/profdata/llvm-23/mix_sample.proftext | 17 +++ tests/data/profdata/llvm-23/multi.memprofraw | Bin 0 -> 1920 bytes .../llvm-23/multiple-profdata-merge.proftext | 106 ++++++++++++++++++ .../data/profdata/llvm-23/no-counts.proftext | 3 + tests/data/profdata/llvm-23/noncs.proftext | 11 ++ .../profdata/llvm-23/overflow-instr.proftext | 6 + .../profdata/llvm-23/overflow-sample.proftext | 7 ++ .../data/profdata/llvm-23/overlap_1.proftext | 36 ++++++ .../profdata/llvm-23/overlap_1_cs.proftext | 11 ++ .../profdata/llvm-23/overlap_1_vp.proftext | 25 +++++ .../data/profdata/llvm-23/overlap_2.proftext | 36 ++++++ .../profdata/llvm-23/overlap_2_cs.proftext | 11 ++ .../profdata/llvm-23/overlap_2_vp.proftext | 25 +++++ .../llvm-23/padding-histogram.memprofraw | Bin 0 -> 19608 bytes tests/data/profdata/llvm-23/pic.memprofraw | Bin 0 -> 1152 bytes .../llvm-23/pseudo-count-hot.proftext | 6 + .../llvm-23/pseudo-count-warm.proftext | 6 + .../llvm-23/pseudo-probe-profile.proftext | 9 ++ .../profdata/llvm-23/same-name-1.proftext | 10 ++ .../profdata/llvm-23/same-name-2.proftext | 10 ++ .../profdata/llvm-23/same-name-3.proftext | 16 +++ .../profdata/llvm-23/same-name-4.proftext | 16 +++ .../llvm-23/sample-empty-lines.proftext | 9 ++ .../sample-flatten-profile-cs.proftext | 20 ++++ .../llvm-23/sample-flatten-profile.proftext | 49 ++++++++ .../data/profdata/llvm-23/sample-fs.proftext | 7 ++ .../llvm-23/sample-hot-func-list.proftext | 41 +++++++ .../sample-multiple-nametables.profdata | Bin 0 -> 165 bytes .../sample-nametable-after-samples.profdata | Bin 0 -> 96 bytes .../sample-nametable-empty-string.profdata | Bin 0 -> 122 bytes .../llvm-23/sample-overlap-0.proftext | 18 +++ .../llvm-23/sample-overlap-1.proftext | 18 +++ .../llvm-23/sample-overlap-2.proftext | 18 +++ .../llvm-23/sample-overlap-3.proftext | 18 +++ .../llvm-23/sample-overlap-4.proftext | 18 +++ .../llvm-23/sample-overlap-5.proftext | 18 +++ .../llvm-23/sample-profile-ext.proftext | 18 +++ .../profdata/llvm-23/sample-profile.proftext | 16 +++ .../profdata/llvm-23/sample-remap.proftext | 18 +++ .../profdata/llvm-23/split-layout.profdata | Bin 0 -> 521 bytes .../thinlto_indirect_call_promotion.profraw | Bin 0 -> 528 bytes ...unknown.section.compressed.extbin.profdata | Bin 0 -> 401 bytes .../llvm-23/unknown.section.extbin.profdata | Bin 0 -> 394 bytes .../data/profdata/llvm-23/vp-malform.proftext | 42 +++++++ .../profdata/llvm-23/vp-malform2.proftext | 32 ++++++ .../profdata/llvm-23/vp-truncate.proftext | 36 ++++++ .../llvm-23/vtable-value-prof.proftext | 74 ++++++++++++ .../llvm-23/weight-instr-bar.profdata | Bin 0 -> 1320 bytes .../llvm-23/weight-instr-foo.profdata | Bin 0 -> 1320 bytes .../llvm-23/weight-sample-bar.proftext | 8 ++ .../llvm-23/weight-sample-foo.proftext | 8 ++ .../misc/v11_uniform_counters.profraw | Bin 0 -> 432 bytes tests/profdata.rs | 40 ++++++- 102 files changed, 1423 insertions(+), 11 deletions(-) create mode 100644 tests/data/profdata/llvm-23/CSIR_profile.proftext create mode 100644 tests/data/profdata/llvm-23/FUnique.proftext create mode 100644 tests/data/profdata/llvm-23/IR_profile.proftext create mode 100644 tests/data/profdata/llvm-23/NoFUnique.proftext create mode 100644 tests/data/profdata/llvm-23/bad-hash.proftext create mode 100644 tests/data/profdata/llvm-23/bar3-1.proftext create mode 100644 tests/data/profdata/llvm-23/basic-histogram.memprofraw create mode 100644 tests/data/profdata/llvm-23/basic.memprofraw create mode 100644 tests/data/profdata/llvm-23/basic.profraw create mode 100644 tests/data/profdata/llvm-23/basic.proftext create mode 100644 tests/data/profdata/llvm-23/basic_v3.memprofraw create mode 100644 tests/data/profdata/llvm-23/basic_v4.memprofraw create mode 100644 tests/data/profdata/llvm-23/buildid.memprofraw create mode 100644 tests/data/profdata/llvm-23/c-general.profraw create mode 100644 tests/data/profdata/llvm-23/clang_profile.proftext create mode 100644 tests/data/profdata/llvm-23/compat.profdata.v1 create mode 100644 tests/data/profdata/llvm-23/compat.profdata.v10 create mode 100644 tests/data/profdata/llvm-23/compat.profdata.v2 create mode 100644 tests/data/profdata/llvm-23/compat.profdata.v4 create mode 100644 tests/data/profdata/llvm-23/compressed.profraw create mode 100644 tests/data/profdata/llvm-23/counter-mismatch-1.proftext create mode 100644 tests/data/profdata/llvm-23/counter-mismatch-2.proftext create mode 100644 tests/data/profdata/llvm-23/counter-mismatch-3.proftext create mode 100644 tests/data/profdata/llvm-23/counter-mismatch-4.proftext create mode 100644 tests/data/profdata/llvm-23/cs-sample-preinline-probe.proftext create mode 100644 tests/data/profdata/llvm-23/cs-sample-preinline.proftext create mode 100644 tests/data/profdata/llvm-23/cs-sample.proftext create mode 100644 tests/data/profdata/llvm-23/cs.proftext create mode 100644 tests/data/profdata/llvm-23/cutoff.proftext create mode 100644 tests/data/profdata/llvm-23/empty.proftext create mode 100644 tests/data/profdata/llvm-23/extra-word.proftext create mode 100644 tests/data/profdata/llvm-23/fe-basic.proftext create mode 100644 tests/data/profdata/llvm-23/flatten_instr.proftext create mode 100644 tests/data/profdata/llvm-23/flatten_sample.proftext create mode 100644 tests/data/profdata/llvm-23/foo3-1.proftext create mode 100644 tests/data/profdata/llvm-23/foo3-2.proftext create mode 100644 tests/data/profdata/llvm-23/foo3bar3-1.proftext create mode 100644 tests/data/profdata/llvm-23/function-entry-coverage.profdata create mode 100644 tests/data/profdata/llvm-23/header-directives-1.proftext create mode 100644 tests/data/profdata/llvm-23/header-directives-2.proftext create mode 100644 tests/data/profdata/llvm-23/header-directives-3.proftext create mode 100644 tests/data/profdata/llvm-23/inline.memprofraw create mode 100644 tests/data/profdata/llvm-23/instr-remap.proftext create mode 100644 tests/data/profdata/llvm-23/invalid-count-later.proftext create mode 100644 tests/data/profdata/llvm-23/ir-basic.proftext create mode 100644 tests/data/profdata/llvm-23/mix_instr.proftext create mode 100644 tests/data/profdata/llvm-23/mix_instr_small.proftext create mode 100644 tests/data/profdata/llvm-23/mix_sample.proftext create mode 100644 tests/data/profdata/llvm-23/multi.memprofraw create mode 100644 tests/data/profdata/llvm-23/multiple-profdata-merge.proftext create mode 100644 tests/data/profdata/llvm-23/no-counts.proftext create mode 100644 tests/data/profdata/llvm-23/noncs.proftext create mode 100644 tests/data/profdata/llvm-23/overflow-instr.proftext create mode 100644 tests/data/profdata/llvm-23/overflow-sample.proftext create mode 100644 tests/data/profdata/llvm-23/overlap_1.proftext create mode 100644 tests/data/profdata/llvm-23/overlap_1_cs.proftext create mode 100644 tests/data/profdata/llvm-23/overlap_1_vp.proftext create mode 100644 tests/data/profdata/llvm-23/overlap_2.proftext create mode 100644 tests/data/profdata/llvm-23/overlap_2_cs.proftext create mode 100644 tests/data/profdata/llvm-23/overlap_2_vp.proftext create mode 100644 tests/data/profdata/llvm-23/padding-histogram.memprofraw create mode 100644 tests/data/profdata/llvm-23/pic.memprofraw create mode 100644 tests/data/profdata/llvm-23/pseudo-count-hot.proftext create mode 100644 tests/data/profdata/llvm-23/pseudo-count-warm.proftext create mode 100644 tests/data/profdata/llvm-23/pseudo-probe-profile.proftext create mode 100644 tests/data/profdata/llvm-23/same-name-1.proftext create mode 100644 tests/data/profdata/llvm-23/same-name-2.proftext create mode 100644 tests/data/profdata/llvm-23/same-name-3.proftext create mode 100644 tests/data/profdata/llvm-23/same-name-4.proftext create mode 100644 tests/data/profdata/llvm-23/sample-empty-lines.proftext create mode 100644 tests/data/profdata/llvm-23/sample-flatten-profile-cs.proftext create mode 100644 tests/data/profdata/llvm-23/sample-flatten-profile.proftext create mode 100644 tests/data/profdata/llvm-23/sample-fs.proftext create mode 100644 tests/data/profdata/llvm-23/sample-hot-func-list.proftext create mode 100644 tests/data/profdata/llvm-23/sample-multiple-nametables.profdata create mode 100644 tests/data/profdata/llvm-23/sample-nametable-after-samples.profdata create mode 100644 tests/data/profdata/llvm-23/sample-nametable-empty-string.profdata create mode 100644 tests/data/profdata/llvm-23/sample-overlap-0.proftext create mode 100644 tests/data/profdata/llvm-23/sample-overlap-1.proftext create mode 100644 tests/data/profdata/llvm-23/sample-overlap-2.proftext create mode 100644 tests/data/profdata/llvm-23/sample-overlap-3.proftext create mode 100644 tests/data/profdata/llvm-23/sample-overlap-4.proftext create mode 100644 tests/data/profdata/llvm-23/sample-overlap-5.proftext create mode 100644 tests/data/profdata/llvm-23/sample-profile-ext.proftext create mode 100644 tests/data/profdata/llvm-23/sample-profile.proftext create mode 100644 tests/data/profdata/llvm-23/sample-remap.proftext create mode 100644 tests/data/profdata/llvm-23/split-layout.profdata create mode 100644 tests/data/profdata/llvm-23/thinlto_indirect_call_promotion.profraw create mode 100644 tests/data/profdata/llvm-23/unknown.section.compressed.extbin.profdata create mode 100644 tests/data/profdata/llvm-23/unknown.section.extbin.profdata create mode 100644 tests/data/profdata/llvm-23/vp-malform.proftext create mode 100644 tests/data/profdata/llvm-23/vp-malform2.proftext create mode 100644 tests/data/profdata/llvm-23/vp-truncate.proftext create mode 100644 tests/data/profdata/llvm-23/vtable-value-prof.proftext create mode 100644 tests/data/profdata/llvm-23/weight-instr-bar.profdata create mode 100644 tests/data/profdata/llvm-23/weight-instr-foo.profdata create mode 100644 tests/data/profdata/llvm-23/weight-sample-bar.proftext create mode 100644 tests/data/profdata/llvm-23/weight-sample-foo.proftext create mode 100644 tests/data/profdata/misc/v11_uniform_counters.profraw diff --git a/Cargo.toml b/Cargo.toml index 7f5bfe9..7ef0868 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,6 +33,7 @@ __llvm_19 = [] __llvm_20 = [] __llvm_21 = [] __llvm_22 = [] +__llvm_23 = [] [dependencies] anyhow = "1.0.65" diff --git a/src/instrumentation_profile/raw_profile.rs b/src/instrumentation_profile/raw_profile.rs index 3b88500..004c6e5 100644 --- a/src/instrumentation_profile/raw_profile.rs +++ b/src/instrumentation_profile/raw_profile.rs @@ -240,7 +240,7 @@ where || counter_offset > max_counters || counter_offset + data.num_counters as i64 > max_counters { - error!("consistency check for reading counts failed"); + error!("consistency check for reading counts failed"); //Err(Err::Failure(Error::new(bytes, ErrorKind::Satisfy))) TODO Err(Err::Failure(VerboseError::from_error_kind( bytes, @@ -405,6 +405,36 @@ where debug!("Applying padding bytes after counters"); let (bytes, _) = take(counters_end)(input)?; input = bytes; + + // compiler-rt writes the body as: data, PaddingBytesBeforeCounters, counters, + // PaddingBytesAfterCounters, bitmap, PaddingBytesAfterBitmapBytes, uniform counters, + // PaddingBytesAfterUniformCounters, names (see the IOVec list in + // lprofWriteDataImpl, compiler-rt/lib/profile/InstrProfilingWriter.c). + // + // The take above stops at the end of PaddingBytesAfterCounters, so everything + // between there and the names section has to be stepped over explicitly. + // Otherwise the names parser starts reading inside the bitmap or the uniform + // counter data and produces garbage symbol names. + // + // Both sections are zero-sized in the common case, which is why this went + // unnoticed: the bitmap is only populated for MC/DC instrumentation, and + // NumUniformCounters is 0 unless the uniform counter section is emitted. The + // arithmetic below is a no-op in that case. + let uniform_counters_size = + (header.num_uniform_counters as usize).saturating_mul(std::mem::size_of::()); + let pre_names_sections = (header.num_bitmap_bytes as usize) + .saturating_add(header.padding_bytes_after_bitmap_bytes as usize) + .saturating_add(uniform_counters_size) + .saturating_add(header.padding_bytes_after_uniform_counters as usize); + if pre_names_sections > 0 { + debug!( + "Skipping {} bytes of bitmap and uniform counter data before names", + pre_names_sections + ); + let (bytes, _) = take(pre_names_sections)(input)?; + input = bytes; + } + let end_length = input.len() - header.names_len as usize; let mut names_section = Vec::with_capacity(data_section.len()); while input.len() > end_length { @@ -493,15 +523,19 @@ where // Raw profile version 11 (LLVM 23) inserts three uint64 fields here, before // NamesSize. Without reading them every subsequent field is off by 24 bytes. - let (bytes, num_uniform_counters, padding_bytes_after_uniform_counters, uniform_counters_delta) = - if (version & !VARIANT_MASKS_ALL) >= 11 { - let (bytes, num_uniform_counters) = nom_u64(endianness)(bytes)?; - let (bytes, padding_after) = nom_u64(endianness)(bytes)?; - let (bytes, uniform_delta) = nom_u64(endianness)(bytes)?; - (bytes, num_uniform_counters, padding_after, uniform_delta) - } else { - (bytes, 0, 0, 0) - }; + let ( + bytes, + num_uniform_counters, + padding_bytes_after_uniform_counters, + uniform_counters_delta, + ) = if (version & !VARIANT_MASKS_ALL) >= 11 { + let (bytes, num_uniform_counters) = nom_u64(endianness)(bytes)?; + let (bytes, padding_after) = nom_u64(endianness)(bytes)?; + let (bytes, uniform_delta) = nom_u64(endianness)(bytes)?; + (bytes, num_uniform_counters, padding_after, uniform_delta) + } else { + (bytes, 0, 0, 0) + }; let (bytes, names_len) = nom_u64(endianness)(bytes)?; let (bytes, counters_delta) = nom_u64(endianness)(bytes)?; diff --git a/tests/data/profdata/llvm-23/CSIR_profile.proftext b/tests/data/profdata/llvm-23/CSIR_profile.proftext new file mode 100644 index 0000000..0881a53 --- /dev/null +++ b/tests/data/profdata/llvm-23/CSIR_profile.proftext @@ -0,0 +1,11 @@ +# CSIR level Instrumentation Flag +:csir +bar +# Func Hash: +1152921534274394772 +# Num Counters: +2 +# Counter Values: +99938 +62 + diff --git a/tests/data/profdata/llvm-23/FUnique.proftext b/tests/data/profdata/llvm-23/FUnique.proftext new file mode 100644 index 0000000..da169b1 --- /dev/null +++ b/tests/data/profdata/llvm-23/FUnique.proftext @@ -0,0 +1,30 @@ +# IR level Instrumentation Flag +:ir +_Z3barmi +# Func Hash: +784007056844089447 +# Num Counters: +2 +# Counter Values: +0 +0 + +main +# Func Hash: +784007059655560962 +# Num Counters: +2 +# Counter Values: +1 +0 + +test.c;_ZL3foom.__uniq.276699478366846449772231447066107882794 +# Func Hash: +1124680652115249575 +# Num Counters: +3 +# Counter Values: +0 +0 +0 + diff --git a/tests/data/profdata/llvm-23/IR_profile.proftext b/tests/data/profdata/llvm-23/IR_profile.proftext new file mode 100644 index 0000000..7b7340e --- /dev/null +++ b/tests/data/profdata/llvm-23/IR_profile.proftext @@ -0,0 +1,9 @@ +:ir +main +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +1 + diff --git a/tests/data/profdata/llvm-23/NoFUnique.proftext b/tests/data/profdata/llvm-23/NoFUnique.proftext new file mode 100644 index 0000000..a3df42f --- /dev/null +++ b/tests/data/profdata/llvm-23/NoFUnique.proftext @@ -0,0 +1,30 @@ +# IR level Instrumentation Flag +:ir +_Z3barmi +# Func Hash: +784007056844089447 +# Num Counters: +2 +# Counter Values: +0 +0 + +main +# Func Hash: +784007059655560962 +# Num Counters: +2 +# Counter Values: +1 +0 + +test.c;_ZL3foom +# Func Hash: +1124680652115249575 +# Num Counters: +3 +# Counter Values: +0 +0 +0 + diff --git a/tests/data/profdata/llvm-23/bad-hash.proftext b/tests/data/profdata/llvm-23/bad-hash.proftext new file mode 100644 index 0000000..faa6f40 --- /dev/null +++ b/tests/data/profdata/llvm-23/bad-hash.proftext @@ -0,0 +1,4 @@ +function_count_not +badhash +1 +1 diff --git a/tests/data/profdata/llvm-23/bar3-1.proftext b/tests/data/profdata/llvm-23/bar3-1.proftext new file mode 100644 index 0000000..5486e9d --- /dev/null +++ b/tests/data/profdata/llvm-23/bar3-1.proftext @@ -0,0 +1,6 @@ +bar +3 +3 +1 +2 +3 diff --git a/tests/data/profdata/llvm-23/basic-histogram.memprofraw b/tests/data/profdata/llvm-23/basic-histogram.memprofraw new file mode 100644 index 0000000000000000000000000000000000000000..d4920769a5c08d0f963d4c041368a3868445485e GIT binary patch literal 20256 zcmeI4TS!z<6o!}g3*{(f7cd+{qD)JOLMrHhNz{WH*hPDo=_Q=P3qoR+w;;PvNzMe) zKqZD+Q9XzlM5Yiu6qE)*6qONC7(_wQLzbPjFLL%FFvG|H49kD*J^wm;&9{ACEj9b9 zYN{(HV@N*UBB{A*ofoP03#G=ZeIl>OitATS?Qk+*t=1GRC}@2;zPNJ7@%rBlA==Zq zHQz9P>6+|sBJ#vt5lU*U>%+f%Z!&Y@A3toYUw5^uDqQ(2_LEUR5)gHPvLmvd{6cm8 z@XN}^oxT&btp&RdmBejmxRriy!l+LU3IFJ;u&NIl^#_k8u1E~eO9+;G((3NCoqBh1 z;ImoZF8moGsWf)ZsNenl@Xe$Q--q;yV>j*(=JXYXPNo|5#cjgh*(B>IS*~^eJxl7+ zQoNMC_U_v!*KdzZrfuoGWYl}}MSa8GQlWI&GS1(2zJGJ>qq6Ms;g;14^Oi32zkV=k z)=TcA?cK6IS+4c@ZLQ-2@M7*(nD< zI_Cq7L&Uc;_>;+AYoh49SU-u=&Iqt1IDQhlb9`O)*UxX*8q{Ih**)t%^_{3zDcG@GyyMKz{bGKY-d9&eb4%o0 zxb;<1dp62>W%_%q+IP0v^y&XMw=bvG^y&N7e*M0La_MV!`StH{`%ed?|A))}2S9l4 A(EtDd literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/basic.memprofraw b/tests/data/profdata/llvm-23/basic.memprofraw new file mode 100644 index 0000000000000000000000000000000000000000..6943c18c747929753f5a7fff69b98f1d61e312b9 GIT binary patch literal 1152 zcmZoHO3N=Q$oNa& z^t5eZGd#LDnEz~&LQ&Xo#x$g!fq{QIgl2&9VfttPjlZv=%W>{hU6t9&#rd=IuCl#G z(SKnjSbt{J9x%{~r|n0+Yb%FW#LA)jttM ze`yn!Cf96X&dC}4G8Mb~yB^Qm{tiWd!%47uMV3<#{Q(d@%>Ib4)$8~aA4R`H30Plk zVi!dJf*@B*s{*uU`SBy`XNGbZ(P(5faJB+e6^Mqip8_R87zAK!c_15vsR5wLmH}il zjEzonK`jE&APjQ{R2WVXau+PjKr{#|_(8OSXc!x27;?Cwy9dS}Xm^3!3UdqdbPcf6 jdw;J2rxUn1)I%`&`Du`HV7Uz>UBdhcr=jK?LsJI;^+lXr literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/basic.profraw b/tests/data/profdata/llvm-23/basic.profraw new file mode 100644 index 0000000000000000000000000000000000000000..1b284b84fad6dd7f9407b1c3b99cb178af0e09c6 GIT binary patch literal 192 zcmZoHO3N=Q$obF700xW@ih%*nfC`}VVd`Ks8#LPSf1^|x6Ds2D& literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/basic.proftext b/tests/data/profdata/llvm-23/basic.proftext new file mode 100644 index 0000000..db934da --- /dev/null +++ b/tests/data/profdata/llvm-23/basic.proftext @@ -0,0 +1,19 @@ +foo +10 +2 +499500 +179900 + +main +16650 +4 +1 +1000 +1000000 +499500 + +foo2 +10 +2 +500500 +180100 diff --git a/tests/data/profdata/llvm-23/basic_v3.memprofraw b/tests/data/profdata/llvm-23/basic_v3.memprofraw new file mode 100644 index 0000000000000000000000000000000000000000..62b7d299d3aa14bfac3ca2c8d9438ec976013052 GIT binary patch literal 880 zcmZoHO3N=Q$of6;J^!Dgx> ziX<|}z|!VVJp)6pEre!(@(vXAqBOP_eE|PfqF+E5te(+Q3Zh>? z2u1&b$BvF#VC5 zPZ~b8c6+z265hDJ!@*t4IOz+rer70#5sgMx17|BhRe@+I`zDYH!XN-+X9C$EObq}{ zwhSOEU~F`n3u+OF24R>xpu%v9kh@@E2BJY&!4IMpM8nuH!;r%b-90e=K)Va%R+w7~ mf;7NR?|rTXPA4#Nm_K0h{fdxs;A9#kUBcvHG)&z#G<5(Ynxaqu literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/buildid.memprofraw b/tests/data/profdata/llvm-23/buildid.memprofraw new file mode 100644 index 0000000000000000000000000000000000000000..c6aec8d0b59e1c9d7e204af2f5819bb43429c99a GIT binary patch literal 1152 zcmZoHO3N=Q$oMx$X2+{xH z1d9IBCN52`*}|NYGx%jHcK3HZp11uSs(y%i#TE$7aN#(L{)n&D>-ZGopUdaAu066( zceDSLPEi#71#`jb7tWs#vEKl~hq-^bY=w-V0)vj}-iPN`@3`<^#(m*@6#W4WV12a{ zr$O{zs0Gt7{a#bIx)_{}(#bg3s4s4zq?T~+*hLim29WT+xabZour z;4%rVr`tEL3ecM6$B(R^8OmWqqmk9X*$PlqAR5Z%0;Vev1_2n`3CIRvY5=Iw3?Q3f zY;>9nY7vMAW1s?e$1mu7)E&vO25Dmf#eh`%)8pej{MGiM~_rUlA?Jkg8VQyib mt^sy>@9$OMbOINLdI%;zKMhh2EYE?YOPD|5G}N49XzBo}Eu>ih literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/c-general.profraw b/tests/data/profdata/llvm-23/c-general.profraw new file mode 100644 index 0000000000000000000000000000000000000000..dec90151a79352bf898c8c9d1d2d23eaa4bf5eed GIT binary patch literal 2152 zcma)7U1-x#7)@qsr`Fj~8S|G-P_~DuOf4dv&MK2plp$E=*oR|qYKI~l|#0M2oUo7Gjd=imPec2En{38~7kI-9&$;;_E-}%n{ZgP{JHWS1& zG-nA{dHE_Smu0wHdV?Cb|8o9bog+^6{$0me6Xb@vqSYxiRC<#iUjFmbRc|4=f7$K*Ydmkyct^+tz(pLV;w@IXCNRJ z+M}C_YkfT~bJ*wA^zo7UV6H#=a=N^L;WB3dGta4+;$!2|m+d_@()>o3IXp8@-wR)O-}M7_p{rbY>+*Twy+Ryv<5U1fC}->KR0lRw4)jwl zQ$!v(5IXXKw2j+Be?VXHAC5lwfvgS=oX>~*gmVCnKIq`cVR11G6v6R5VEy3BsNYKw zI^r-75c2>9Y6PMW9O#)RAL}*IIuJUQIdCBUKY-AI*cT8w5c>f_kJAO$QG_0*9Ek4` z>hMEvrhXuMj?o7l=MWsYl9>a#TR+yJF;({w=cI-jYMJ%W58ouuS!&wQ6j39@uy~p1 zan)9dE@>98NT!w*l|j|E_+y!LscfB4Z8@b_d`wM>Wx~e@(G*D+iJ_R1P0UiUq!6Pz s@t=i{6EPuanw>I9CYj>XlB)A^TT;cVsdIR z0}D(qD$U5i&n{WL$G3C2FjN9&Qd((Va!F=>UVL(XXyx;Dt(AKFRzf3R|w4_1d!$z1?j_bp!l literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/compat.profdata.v10 b/tests/data/profdata/llvm-23/compat.profdata.v10 new file mode 100644 index 0000000000000000000000000000000000000000..c331e30b48ff5d3be2efe4636d0c9fee56e764b5 GIT binary patch literal 872 zcmeyLQ&5zjmf6U~fE@@hqlzb>@!6o#0#KR>O2d@>u3-d=z-Xv61B@@A4iSOzA*vY| z7PO)2gNZxvLQFfBWuhChXCFj_ zk>S_X-sfg1Q*X0CRT@C)+{Da0E=LFlCdUYsdjYk{!HFL%g5op>s3Mq^Q0^#2qY%)b Ok-4~xO~oaFLmU7ea2Txs literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/compat.profdata.v4 b/tests/data/profdata/llvm-23/compat.profdata.v4 new file mode 100644 index 0000000000000000000000000000000000000000..7db0d1d3f3e9d42e88f9a64ecd3ac65e69e893ca GIT binary patch literal 1336 zcmeyLQ&5zjmf6U{fE{QsL&Vvj(n3%gD$Kx%s!ajPh0y}PYZyU7_5$iq83?5S76q~w zw82|g;X0auSp{D3-&j|7;Y8gYpytm8s9 zAFiIklm}Uy1Lm6ryLpktSzx~TP{)T=+(4QiS)38(%LqH{;&&Xei<>!N7q`bD&d9*~ z`sf6Er3H}!Q2RBYbY5a^szP~YNrpmkL1J=hF$2^Ku#iG_E{M$m6<}oGXP2zr literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/compressed.profraw b/tests/data/profdata/llvm-23/compressed.profraw new file mode 100644 index 0000000000000000000000000000000000000000..778e80fce2691a35d9654748763b0aa8c233ec13 GIT binary patch literal 2104 zcma)-Ur1A77{-r!=9VsnY+$yj7cP^sfx~d6 z;zDgPqk;;8uA++~LRVM>j?#v!AS9-Cvr&SYvZ#H}#l9h(-Td}E-}^q_d(QcG*4=vU zLaVJgmdPZ3go%=IP@1c3Cxu7WV*ftMRj;J)Q7l&Yx?#4hCOIXQSf5M2Ah3jPo(?e)RZti}u4IeXcx*6_GipvLv~ga@fi@Y>B_ksxa=&Qj1sk z`#I)pqH=16I;1?Gq;8wH(p1*?jp3S;OXb+5Z{@qL4!$h6IGvMYBg`LhcM4;rDL!ZOd zX?Iv=_Js0Dem=*X6lxyBJE5xL&YAYW$@oH${A1o#s6cOD> zh&*TzKJr1*#vCMH;1~QyqYw2U?L&hb)!{zj96+NFJ~VP@W}tu&8t((T9y*)U^9kW2 z4)cJR2V_Yhh(2hLw?RJkD;Nu)ZgIlRN;B&3VJ|rgTKH{9Dk^%v>ANo<}OR;y%HuY6!r5+IQ#=Czp zbv;i^PyHH8hWldY;nC%}@N>sVfB8`LmkOmlB=Nh;u2>f{SEL2D`t^^|{ypwA*~4XC z@Uv%fieGig7p=XtmUlTXSeUJSFYB64zdbQ#+#On2GPDc~X(M{w*Q!^FroSWo0ht8+ Ao&W#< literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/counter-mismatch-1.proftext b/tests/data/profdata/llvm-23/counter-mismatch-1.proftext new file mode 100644 index 0000000..45d028e --- /dev/null +++ b/tests/data/profdata/llvm-23/counter-mismatch-1.proftext @@ -0,0 +1,13 @@ +foo +1024 +1 +0 + +foo +1024 +5 +0 +0 +0 +0 +0 diff --git a/tests/data/profdata/llvm-23/counter-mismatch-2.proftext b/tests/data/profdata/llvm-23/counter-mismatch-2.proftext new file mode 100644 index 0000000..261bfdd --- /dev/null +++ b/tests/data/profdata/llvm-23/counter-mismatch-2.proftext @@ -0,0 +1,5 @@ +foo +1024 +2 +0 +0 diff --git a/tests/data/profdata/llvm-23/counter-mismatch-3.proftext b/tests/data/profdata/llvm-23/counter-mismatch-3.proftext new file mode 100644 index 0000000..ca70a71 --- /dev/null +++ b/tests/data/profdata/llvm-23/counter-mismatch-3.proftext @@ -0,0 +1,6 @@ +foo +1024 +3 +0 +0 +0 diff --git a/tests/data/profdata/llvm-23/counter-mismatch-4.proftext b/tests/data/profdata/llvm-23/counter-mismatch-4.proftext new file mode 100644 index 0000000..f403382 --- /dev/null +++ b/tests/data/profdata/llvm-23/counter-mismatch-4.proftext @@ -0,0 +1,7 @@ +foo +1024 +4 +0 +0 +0 +0 diff --git a/tests/data/profdata/llvm-23/cs-sample-preinline-probe.proftext b/tests/data/profdata/llvm-23/cs-sample-preinline-probe.proftext new file mode 100644 index 0000000..56624dd --- /dev/null +++ b/tests/data/profdata/llvm-23/cs-sample-preinline-probe.proftext @@ -0,0 +1,48 @@ +[main:3 @ _Z5funcAi:1 @ _Z8funcLeafi]:1467299:11 + 0: 6 + 1: 6 + 3: 287884 + 4: 287864 _Z3fibi:315608 + 15: 23 + !CFGChecksum: 281479271677951 + !Attributes: 2 +[main:3.1 @ _Z5funcBi:1 @ _Z8funcLeafi]:500853:20 + 0: 15 + 1: 15 + 3: 74946 + 4: 74941 _Z3fibi:82359 + 10: 23324 + 11: 23327 _Z3fibi:25228 + 15: 11 + !CFGChecksum: 281479271677951 + !Attributes: 2 +[external:12 @ main]:154:12 + 2: 12 + 3: 10 _Z5funcAi:7 + 3.1: 10 _Z5funcBi:11 + !CFGChecksum: 563125815542069 +[main]:154:0 + 2: 12 + 3: 18 _Z5funcAi:11 + 3.1: 18 _Z5funcBi:19 + !CFGChecksum: 563125815542069 +[external:10 @ _Z5funcBi]:120:10 + 0: 10 + 1: 10 + !CFGChecksum: 563022570642068 +[externalA:17 @ _Z5funcBi]:120:3 + 0: 3 + 1: 3 + !CFGChecksum: 563022570642068 +[main:3.1 @ _Z5funcBi]:120:19 + 0: 19 + 1: 19 _Z8funcLeafi:20 + 3: 12 + !CFGChecksum: 563022570642068 + !Attributes: 2 +[main:3 @ _Z5funcAi]:99:11 + 0: 10 + 1: 10 _Z8funcLeafi:11 + 3: 24 + !CFGChecksum: 844530426352218 + !Attributes: 2 diff --git a/tests/data/profdata/llvm-23/cs-sample-preinline.proftext b/tests/data/profdata/llvm-23/cs-sample-preinline.proftext new file mode 100644 index 0000000..ff469b8 --- /dev/null +++ b/tests/data/profdata/llvm-23/cs-sample-preinline.proftext @@ -0,0 +1,40 @@ +[main:3 @ _Z5funcAi:1 @ _Z8funcLeafi]:1467299:11 + 0: 6 + 1: 6 + 3: 287884 + 4: 287864 _Z3fibi:315608 + 15: 23 + !Attributes: 2 +[main:3.1 @ _Z5funcBi:1 @ _Z8funcLeafi]:500853:20 + 0: 15 + 1: 15 + 3: 74946 + 4: 74941 _Z3fibi:82359 + 10: 23324 + 11: 23327 _Z3fibi:25228 + 15: 11 + !Attributes: 2 +[external:12 @ main]:154:12 + 2: 12 + 3: 10 _Z5funcAi:7 + 3.1: 10 _Z5funcBi:11 +[main]:154:0 + 2: 12 + 3: 18 _Z5funcAi:11 + 3.1: 18 _Z5funcBi:19 +[external:10 @ _Z5funcBi]:120:10 + 0: 10 + 1: 10 +[externalA:17 @ _Z5funcBi]:120:3 + 0: 3 + 1: 3 +[main:3.1 @ _Z5funcBi]:120:19 + 0: 19 + 1: 19 _Z8funcLeafi:20 + 3: 12 + !Attributes: 2 +[main:3 @ _Z5funcAi]:99:11 + 0: 10 + 1: 10 _Z8funcLeafi:11 + 3: 24 + !Attributes: 2 diff --git a/tests/data/profdata/llvm-23/cs-sample.proftext b/tests/data/profdata/llvm-23/cs-sample.proftext new file mode 100644 index 0000000..c342d12 --- /dev/null +++ b/tests/data/profdata/llvm-23/cs-sample.proftext @@ -0,0 +1,38 @@ +[main:3 @ _Z5funcAi:1 @ _Z8funcLeafi]:1467299:11 + 0: 6 + 1: 6 + 3: 287884 + 4: 287864 _Z3fibi:315608 + 15: 23 +[main:3.1 @ _Z5funcBi:1 @ _Z8funcLeafi]:500853:20 + 0: 15 + 1: 15 + 3: 74946 + 4: 74941 _Z3fibi:82359 + 10: 23324 + 11: 23327 _Z3fibi:25228 + 15: 11 + !Attributes: 1 +[external:12 @ main]:154:12 + 2: 12 + 3: 10 _Z5funcAi:7 + 3.1: 10 _Z5funcBi:11 +[main]:154:0 + 2: 12 + 3: 18 _Z5funcAi:11 + 3.1: 18 _Z5funcBi:19 +[external:10 @ _Z5funcBi]:120:10 + 0: 10 + 1: 10 +[externalA:17 @ _Z5funcBi]:120:3 + 0: 3 + 1: 3 +[main:3.1 @ _Z5funcBi]:120:19 + 0: 19 + 1: 19 _Z8funcLeafi:20 + 3: 12 + !Attributes: 1 +[main:3 @ _Z5funcAi]:99:11 + 0: 10 + 1: 10 _Z8funcLeafi:11 + 3: 24 diff --git a/tests/data/profdata/llvm-23/cs.proftext b/tests/data/profdata/llvm-23/cs.proftext new file mode 100644 index 0000000..99e1825 --- /dev/null +++ b/tests/data/profdata/llvm-23/cs.proftext @@ -0,0 +1,10 @@ +# CSIR level Instrumentation Flag +:csir +bar +# Func Hash: +1152921534274394772 +# Num Counters: +2 +# Counter Values: +99938 +62 diff --git a/tests/data/profdata/llvm-23/cutoff.proftext b/tests/data/profdata/llvm-23/cutoff.proftext new file mode 100644 index 0000000..1ce4843 --- /dev/null +++ b/tests/data/profdata/llvm-23/cutoff.proftext @@ -0,0 +1,21 @@ +# IR level Instrumentation Flag +:ir +bar +10 +2 +0 +0 + +main +16650 +4 +1 +1000 +1000000 +499500 + +foo +10 +2 +999 +1 diff --git a/tests/data/profdata/llvm-23/empty.proftext b/tests/data/profdata/llvm-23/empty.proftext new file mode 100644 index 0000000..e69de29 diff --git a/tests/data/profdata/llvm-23/extra-word.proftext b/tests/data/profdata/llvm-23/extra-word.proftext new file mode 100644 index 0000000..67a6629 --- /dev/null +++ b/tests/data/profdata/llvm-23/extra-word.proftext @@ -0,0 +1,2 @@ +extra 1 word +1 diff --git a/tests/data/profdata/llvm-23/fe-basic.proftext b/tests/data/profdata/llvm-23/fe-basic.proftext new file mode 100644 index 0000000..34aa036 --- /dev/null +++ b/tests/data/profdata/llvm-23/fe-basic.proftext @@ -0,0 +1,6 @@ +:fe +foo +29667547796 +2 +100 +90 diff --git a/tests/data/profdata/llvm-23/flatten_instr.proftext b/tests/data/profdata/llvm-23/flatten_instr.proftext new file mode 100644 index 0000000..e180099 --- /dev/null +++ b/tests/data/profdata/llvm-23/flatten_instr.proftext @@ -0,0 +1,32 @@ +# IR level Instrumentation Flag +:ir +# Always instrument the function entry block +:entry_first +foo +# Func Hash: +1111 +# Num Counters: +5 +# Counter Values: +10000 +50 +2000 +40 +6000 + +bar.cc;bar +# Func Hash: +2222 +# Num Counters: +10 +# Counter Values: +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/tests/data/profdata/llvm-23/flatten_sample.proftext b/tests/data/profdata/llvm-23/flatten_sample.proftext new file mode 100644 index 0000000..9b05b49 --- /dev/null +++ b/tests/data/profdata/llvm-23/flatten_sample.proftext @@ -0,0 +1,12 @@ +foo:12345:1000 + 1: 1000 + 2.1: 1000 + 15: 5000 + 4: bar:1000 + 1: 1000 + 2: goo:3000 + 1: 3000 + 8: bar:40000 + 1: 10000 + 2: goo:30000 + 1: 30000 diff --git a/tests/data/profdata/llvm-23/foo3-1.proftext b/tests/data/profdata/llvm-23/foo3-1.proftext new file mode 100644 index 0000000..14a6200 --- /dev/null +++ b/tests/data/profdata/llvm-23/foo3-1.proftext @@ -0,0 +1,6 @@ +foo +3 +3 +1 +2 +3 diff --git a/tests/data/profdata/llvm-23/foo3-2.proftext b/tests/data/profdata/llvm-23/foo3-2.proftext new file mode 100644 index 0000000..801846e --- /dev/null +++ b/tests/data/profdata/llvm-23/foo3-2.proftext @@ -0,0 +1,6 @@ +foo +3 +3 +7 +5 +3 diff --git a/tests/data/profdata/llvm-23/foo3bar3-1.proftext b/tests/data/profdata/llvm-23/foo3bar3-1.proftext new file mode 100644 index 0000000..12157b9 --- /dev/null +++ b/tests/data/profdata/llvm-23/foo3bar3-1.proftext @@ -0,0 +1,13 @@ +foo +3 +3 +2 +3 +5 + +bar +3 +3 +7 +11 +13 diff --git a/tests/data/profdata/llvm-23/function-entry-coverage.profdata b/tests/data/profdata/llvm-23/function-entry-coverage.profdata new file mode 100644 index 0000000000000000000000000000000000000000..681bcec4b0fb3ba676253e48e424b8a26123c255 GIT binary patch literal 816 zcmeyLQ&5zjmf6V800x2(3PC<#g0R`3LIO~l1&wBe@?kWT%fJj}2<EQ0WD2=sF=;$}|R#qDv3Gcx?T+WXurW$JBM_$h$h!N8E4n3*@_R*;3= zDo!R?XuxO=s2V1QHG3s)`yBca0}ofIOj>^a|NsBrU*_`Vf@y-$FwHr4c0CZimEVD` zH62qc)KCVPRz?Q%t+J9{rNU3pH76w&5waI-7|bM?uVFU8=oc{8LIu>I=^Z8yqvt`z E0ipXoBme*a literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/header-directives-1.proftext b/tests/data/profdata/llvm-23/header-directives-1.proftext new file mode 100644 index 0000000..5566523 --- /dev/null +++ b/tests/data/profdata/llvm-23/header-directives-1.proftext @@ -0,0 +1,8 @@ +:entry_first +:ir +foo +29667547796 +2 +100 +90 + diff --git a/tests/data/profdata/llvm-23/header-directives-2.proftext b/tests/data/profdata/llvm-23/header-directives-2.proftext new file mode 100644 index 0000000..cadd1e9 --- /dev/null +++ b/tests/data/profdata/llvm-23/header-directives-2.proftext @@ -0,0 +1,8 @@ +:ir +:not_entry_first +foo +29667547796 +2 +100 +90 + diff --git a/tests/data/profdata/llvm-23/header-directives-3.proftext b/tests/data/profdata/llvm-23/header-directives-3.proftext new file mode 100644 index 0000000..5820e14 --- /dev/null +++ b/tests/data/profdata/llvm-23/header-directives-3.proftext @@ -0,0 +1,10 @@ +:not_entry_first +:entry_first +:fe +:ir +foo +29667547796 +2 +100 +90 + diff --git a/tests/data/profdata/llvm-23/inline.memprofraw b/tests/data/profdata/llvm-23/inline.memprofraw new file mode 100644 index 0000000000000000000000000000000000000000..8958af941c59d475942551c8e214c9dcf7488b33 GIT binary patch literal 976 zcmZoHO3N=Q$o;y?U?ZWZJqNJ zhK3Ev+Sirpn`SdvTcao}nEYG3o`HeC9YQle`7r&n|Hj`}(d9UIs;LI=c~{w9 zqv*eo3D%z(RRg9O7!trVO#i{#d39m&9c68<;guom*0t;9_y0lBFAxM)fAMZ4RDU3f z{?aBcO|IF(oRc&7Wh!>}cRilB{T+(_f(c;tieDf!g9C(y*&p$>dL5r){B!x-*0o3W z>2CI)(kY6fe?u==|HAwI5c>-te3<^_vK2Cd3Jf}?dmo-(z2m}v8TWXAfc4cT zdO`FrFa*;u{a#bIx)_{}(#bg3s4s4zq?T~+*hLim3n1ZsQD_=O{{#phroX@K)%I5o z`vR9qXg%G&c~yYcEI)o^{m^8=zz7wD(a37xYz3$+h=#J)0n-x*g8+=}4rGHcH2|{v zU~a=lgXCcDK)0WeyHcPUKr{$1XoJ`UqG4>9naJ(}iNW~A(>1_KdVgnu;{zrR%a<^D T&vZzBYl6~iq4aVaNO}MOR8FAm literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/instr-remap.proftext b/tests/data/profdata/llvm-23/instr-remap.proftext new file mode 100644 index 0000000..ddd6671 --- /dev/null +++ b/tests/data/profdata/llvm-23/instr-remap.proftext @@ -0,0 +1,25 @@ +# :ir is the flag to indicate this is IR level profile. +:ir +foo +1234 +2 +1 +2 + +bar +1234 +2 +30 +40 + +foo +5678 +2 +500 +600 + +baz +5678 +2 +7 +8 diff --git a/tests/data/profdata/llvm-23/invalid-count-later.proftext b/tests/data/profdata/llvm-23/invalid-count-later.proftext new file mode 100644 index 0000000..2b61c55 --- /dev/null +++ b/tests/data/profdata/llvm-23/invalid-count-later.proftext @@ -0,0 +1,4 @@ +invalid_count +1 +1 +1later diff --git a/tests/data/profdata/llvm-23/ir-basic.proftext b/tests/data/profdata/llvm-23/ir-basic.proftext new file mode 100644 index 0000000..b177a62 --- /dev/null +++ b/tests/data/profdata/llvm-23/ir-basic.proftext @@ -0,0 +1,6 @@ +:ir +foo2 +29667547796 +2 +100 +90 diff --git a/tests/data/profdata/llvm-23/mix_instr.proftext b/tests/data/profdata/llvm-23/mix_instr.proftext new file mode 100644 index 0000000..d7059e8 --- /dev/null +++ b/tests/data/profdata/llvm-23/mix_instr.proftext @@ -0,0 +1,25 @@ +:ir +foo +7 +5 +12 +13 +0 +0 +0 + +goo +5 +3 +0 +0 +0 + +moo +9 +4 +3000 +1000 +2000 +500 + diff --git a/tests/data/profdata/llvm-23/mix_instr_small.proftext b/tests/data/profdata/llvm-23/mix_instr_small.proftext new file mode 100644 index 0000000..80a2303 --- /dev/null +++ b/tests/data/profdata/llvm-23/mix_instr_small.proftext @@ -0,0 +1,18 @@ +:ir +foo +7 +1 +0 + +goo +5 +3 +0 +0 +0 + +moo +9 +1 +0 + diff --git a/tests/data/profdata/llvm-23/mix_sample.proftext b/tests/data/profdata/llvm-23/mix_sample.proftext new file mode 100644 index 0000000..f61ec7f --- /dev/null +++ b/tests/data/profdata/llvm-23/mix_sample.proftext @@ -0,0 +1,17 @@ +foo:2000:2000 + 1: 2000 +goo:3000:1500 + 1: 1200 + 2: 800 + 3: 1000 +moo:1000:1000 + 1: 1000 +hoo:50:1 + 1: 1 + 2: 2 + 3: 3 + 4: 4 + 5: 5 + 6: 6 + 7: 7 + 8: 8 diff --git a/tests/data/profdata/llvm-23/multi.memprofraw b/tests/data/profdata/llvm-23/multi.memprofraw new file mode 100644 index 0000000000000000000000000000000000000000..3952768d44c680af14d04eb8773a1a323de36ba2 GIT binary patch literal 1920 zcmZoHO3N=Q$oA+!OMZ@~m%6hOr}pyCV+3SgE%mNr}j#1Mh<7MX8XGgLqR zO!ckg_v7xBVT8eupz)^@>LzG=l(yhS?wSwR#<&V*GRY+}5>6 z_UUf+pVBFcqQBuJSpUNHry=$`K=?5I%VjHM1Qi%`O!q!Kzk0`o|1$0i=cDLXC;{uM zP3(f`Ur-39VfwwMZgnv@9i@|Tuu)&!LP;&*-m!})`U@c8e(}*oi2ei!AEv**?bY^I z4*LR^NoYOYzIj!E)+|4MWc|=&!N3R=gwe=q;A{n`EQp4(%YjS~1_2mb7{~@;Y5-*S z!Pw|D7t|sU4Z<*YpxaN#U9d0%(IBkg2QdLe!`Lu0VQzqWodL#Yo~{8_())WAI6mOw zP>nG8`Du{+w%i61|Ba*h7m|J%M)NPIJcXr2TIb&uU;+kV5P-1><`{6V+f1gInzW@SYR`37- literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/multiple-profdata-merge.proftext b/tests/data/profdata/llvm-23/multiple-profdata-merge.proftext new file mode 100644 index 0000000..090a40f --- /dev/null +++ b/tests/data/profdata/llvm-23/multiple-profdata-merge.proftext @@ -0,0 +1,106 @@ +# IR level Instrumentation Flag +:ir +foo +# Func Hash: +36982789018 +# Num Counters: +4 +# Counter Values: +700000 +700000 +0 +0 + +foo +# Func Hash: +59188585735 +# Num Counters: +6 +# Counter Values: +400000 +400000 +0 +0 +0 +0 + +foo +# Func Hash: +27904764724 +# Num Counters: +3 +# Counter Values: +200000 +200000 +0 + +foo +# Func Hash: +60466382370 +# Num Counters: +6 +# Counter Values: +0 +100000 +0 +0 +0 +0 + +bar +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +0 + +foo2 +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +0 + +foo3 +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +0 + +foo4 +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +0 + +foo5 +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +0 + +foo1 +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +100000 + +main +# Func Hash: +29212902728 +# Num Counters: +2 +# Counter Values: +1400000 +14 + diff --git a/tests/data/profdata/llvm-23/no-counts.proftext b/tests/data/profdata/llvm-23/no-counts.proftext new file mode 100644 index 0000000..5c1fa15 --- /dev/null +++ b/tests/data/profdata/llvm-23/no-counts.proftext @@ -0,0 +1,3 @@ +no_counts +0 +0 diff --git a/tests/data/profdata/llvm-23/noncs.proftext b/tests/data/profdata/llvm-23/noncs.proftext new file mode 100644 index 0000000..d1d58fd --- /dev/null +++ b/tests/data/profdata/llvm-23/noncs.proftext @@ -0,0 +1,11 @@ +# IR level Instrumentation Flag +:ir +bar +# Func Hash: +29667547796 +# Num Counters: +2 +# Counter Values: +99938 +62 + diff --git a/tests/data/profdata/llvm-23/overflow-instr.proftext b/tests/data/profdata/llvm-23/overflow-instr.proftext new file mode 100644 index 0000000..1d44643 --- /dev/null +++ b/tests/data/profdata/llvm-23/overflow-instr.proftext @@ -0,0 +1,6 @@ +overflow +1 +3 +18446744073709551613 +9223372036854775808 +18446744073709551613 diff --git a/tests/data/profdata/llvm-23/overflow-sample.proftext b/tests/data/profdata/llvm-23/overflow-sample.proftext new file mode 100644 index 0000000..a5486bb --- /dev/null +++ b/tests/data/profdata/llvm-23/overflow-sample.proftext @@ -0,0 +1,7 @@ +_Z3bari:18446744073709551615:1000 + 1: 18446744073709551615 +_Z3fooi:18446744073709551615:1000 + 1: 18446744073709551615 +main:1000:0 + 1: 500 _Z3bari:18446744073709551615 + 2: 500 _Z3fooi:18446744073709551615 diff --git a/tests/data/profdata/llvm-23/overlap_1.proftext b/tests/data/profdata/llvm-23/overlap_1.proftext new file mode 100644 index 0000000..b12b03e --- /dev/null +++ b/tests/data/profdata/llvm-23/overlap_1.proftext @@ -0,0 +1,36 @@ +# IR level Instrumentation Flag +:ir +bar +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +100000 + +bar1 +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +100000 + +foo +# Func Hash: +25571299074 +# Num Counters: +2 +# Counter Values: +40000 +60000 + +main +# Func Hash: +29212902728 +# Num Counters: +2 +# Counter Values: +200000 +0 + diff --git a/tests/data/profdata/llvm-23/overlap_1_cs.proftext b/tests/data/profdata/llvm-23/overlap_1_cs.proftext new file mode 100644 index 0000000..6d439f3 --- /dev/null +++ b/tests/data/profdata/llvm-23/overlap_1_cs.proftext @@ -0,0 +1,11 @@ +# CSIR level Instrumentation Flag +:csir +bar +# Func Hash: +1152921534274394772 +# Num Counters: +2 +# Counter Values: +6000 +4000 + diff --git a/tests/data/profdata/llvm-23/overlap_1_vp.proftext b/tests/data/profdata/llvm-23/overlap_1_vp.proftext new file mode 100644 index 0000000..6dc9b8b --- /dev/null +++ b/tests/data/profdata/llvm-23/overlap_1_vp.proftext @@ -0,0 +1,25 @@ +:IR +foo +# Func Hash: +72057649435042473 +# Num Counters: +2 +# Counter Values: +40000 +60000 +# Num Value Kinds: +2 +# ValueKind = IPVK_IndirectCallTarget: +0 +# NumValueSites: +1 +2 +bar1:40000 +bar2:60000 +# ValueKind = IPVK_MemOPSize: +1 +# NumValueSites: +1 +2 +1:40000 +4:60000 diff --git a/tests/data/profdata/llvm-23/overlap_2.proftext b/tests/data/profdata/llvm-23/overlap_2.proftext new file mode 100644 index 0000000..499d521 --- /dev/null +++ b/tests/data/profdata/llvm-23/overlap_2.proftext @@ -0,0 +1,36 @@ +# IR level Instrumentation Flag +:ir +bar +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +10000 + +bar2 +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +10000 + +foo +# Func Hash: +25571299075 +# Num Counters: +2 +# Counter Values: +4000 +6000 + +main +# Func Hash: +29212902728 +# Num Counters: +2 +# Counter Values: +20000 +0 + diff --git a/tests/data/profdata/llvm-23/overlap_2_cs.proftext b/tests/data/profdata/llvm-23/overlap_2_cs.proftext new file mode 100644 index 0000000..aa722a9 --- /dev/null +++ b/tests/data/profdata/llvm-23/overlap_2_cs.proftext @@ -0,0 +1,11 @@ +# CSIR level Instrumentation Flag +:csir +bar +# Func Hash: +1152921534274394772 +# Num Counters: +2 +# Counter Values: +4000 +6000 + diff --git a/tests/data/profdata/llvm-23/overlap_2_vp.proftext b/tests/data/profdata/llvm-23/overlap_2_vp.proftext new file mode 100644 index 0000000..5d90deb --- /dev/null +++ b/tests/data/profdata/llvm-23/overlap_2_vp.proftext @@ -0,0 +1,25 @@ +:IR +foo +# Func Hash: +72057649435042473 +# Num Counters: +2 +# Counter Values: +30000 +20000 +# Num Value Kinds: +2 +# ValueKind = IPVK_IndirectCallTarget: +0 +# NumValueSites: +1 +2 +bar1:30000 +bar2:20000 +# ValueKind = IPVK_MemOPSize: +1 +# NumValueSites: +1 +2 +1:3000 +4:2000 diff --git a/tests/data/profdata/llvm-23/padding-histogram.memprofraw b/tests/data/profdata/llvm-23/padding-histogram.memprofraw new file mode 100644 index 0000000000000000000000000000000000000000..df6fcb10cd4feda1212baf3f8e4c229eb8d63953 GIT binary patch literal 19608 zcmeI)-%FEG7zgmv${!gtqF-KY?OjUb(i%Y_)P)y@6=I4}DZ!+o-mvKq3M;e>5(`42 zLTR8#kW^^Fhy|e~h!;k+1yK}~5fKUFw7u%hc}mcvfHIx1NLLBO7~SKMM-h zS9W=gi;wI4_8B4Eueb`e*ZJs7=zU>H?z74EQ=4zyXpT0$%>H8J6GbwAw0^6s&U<9l z`LVZ6?R!F9Cpx$7J-It)OWR%Fqu)k;YKOd^9ID}bV!M$)elD*lFS>N$72EA;eb{~R zV_*EMnXi!d{f9Uw?(ts#|GpomhZp-ppMBx;L*t_*v0Ya$EI0BIugnkh`}qHZyw~|b zZ>wjCC5ktVe0YB6L1NZZG0<=1tA)(9U0%WY#EeCrI=}PU{qo?G`eJ*mW5deQ)oU8w zO(c!{cXm%6*w6VX-s^mK=X89!Y_#TPe&AC)cDp)oy~;f|KVNO;rPaB2Qfo`yqN>&} zoFz>fdhK)8G&3HBGP%lb%=ilkLI45~fB*y_009U<00Izz00bZa0SG_<0uX=z1Rwwb z2tWV=5P$##AOHafKmY;|fB*y_009U<00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$## zAOHafKmY;|fB*y_@E-!IZIz%FL%O$Bdd*kgr%F@zAyUVw@~^%`x@QtqnpPD@snVog zNoR8!WPc`?^CFi#p*!@t1+;KRdet4csM5^zb-H60Rhnh0#S>+0I#HktMq({Z&(~ xnT(e@7oE5BsO?=V7ngnoWdA6AuKPkgt>wO8Z;o&sJjVU1^zXXrd&9PQ?++6`o9O@m literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/pic.memprofraw b/tests/data/profdata/llvm-23/pic.memprofraw new file mode 100644 index 0000000000000000000000000000000000000000..b6a733af50f5d6d19031f6d99270eb397f35e34d GIT binary patch literal 1152 zcmZoHO3N=Q$oKC`)~Yx6nuPEXT(Vqa}!|advTD^`>G5)!H zZtL13`*b(^Pw5mz(SN}mtZ(6ePl)~r5I#)*a@h(QK?MdK)4dPRuikOtzl{6B`6&7o zzDxv#Uu_~6ME`=1U_MO0*VL^p2B)KRG7dKCi(4qECEPo95k>z2NVs1#3V`U}0O7;* z_qV;;{>our;4%rVr`tEL3ecM6$B(R^8OmWqqmk9X*$PlqAR5XJ0!o4~2*B7LKsE?d z13;541IT6=8=dBYS_Gm&80HSBFq|UfE?Ag>Xb@KLgJ=cOFgDCEFm+;&P}Kndy6?8q literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/pseudo-count-hot.proftext b/tests/data/profdata/llvm-23/pseudo-count-hot.proftext new file mode 100644 index 0000000..95bc7ef --- /dev/null +++ b/tests/data/profdata/llvm-23/pseudo-count-hot.proftext @@ -0,0 +1,6 @@ +overflow +1 +3 +18446744073709551615 +0 +0 diff --git a/tests/data/profdata/llvm-23/pseudo-count-warm.proftext b/tests/data/profdata/llvm-23/pseudo-count-warm.proftext new file mode 100644 index 0000000..5b1a5c1 --- /dev/null +++ b/tests/data/profdata/llvm-23/pseudo-count-warm.proftext @@ -0,0 +1,6 @@ +overflow +1 +3 +18446744073709551614 +0 +0 diff --git a/tests/data/profdata/llvm-23/pseudo-probe-profile.proftext b/tests/data/profdata/llvm-23/pseudo-probe-profile.proftext new file mode 100644 index 0000000..82f57d6 --- /dev/null +++ b/tests/data/profdata/llvm-23/pseudo-probe-profile.proftext @@ -0,0 +1,9 @@ +foo:3200:13 + 1: 13 + 2: 7 + 3: 18446744073709551615 + 4: 13 + 5: 7 _Z3foov:5 _Z3barv:2 + 6: 6 _Z3barv:4 _Z3foov:2 + !CFGChecksum: 563022570642068 + !Attributes: 0 diff --git a/tests/data/profdata/llvm-23/same-name-1.proftext b/tests/data/profdata/llvm-23/same-name-1.proftext new file mode 100644 index 0000000..3e0e3c3 --- /dev/null +++ b/tests/data/profdata/llvm-23/same-name-1.proftext @@ -0,0 +1,10 @@ +# IR level Instrumentation Flag +:ir +main +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +1 + diff --git a/tests/data/profdata/llvm-23/same-name-2.proftext b/tests/data/profdata/llvm-23/same-name-2.proftext new file mode 100644 index 0000000..a42ef32 --- /dev/null +++ b/tests/data/profdata/llvm-23/same-name-2.proftext @@ -0,0 +1,10 @@ +# IR level Instrumentation Flag +:ir +main +# Func Hash: +12884901887 +# Num Counters: +1 +# Counter Values: +2 + diff --git a/tests/data/profdata/llvm-23/same-name-3.proftext b/tests/data/profdata/llvm-23/same-name-3.proftext new file mode 100644 index 0000000..e34128f --- /dev/null +++ b/tests/data/profdata/llvm-23/same-name-3.proftext @@ -0,0 +1,16 @@ +_Z3bari:20301:1437 + 1: 1437 +_Z3fooi:7711:610 + 1: 610 +main:184019:0 + 4: 534 + 4.2: 534 + 5: 1075 + 5.1: 1075 + 6: 2080 + 7: 534 + 9: 2064 _Z3bari:1471 _Z3fooi:631 + 10: inline1:1000 + 1: 1000 + 10: inline2:2000 + 1: 2000 diff --git a/tests/data/profdata/llvm-23/same-name-4.proftext b/tests/data/profdata/llvm-23/same-name-4.proftext new file mode 100644 index 0000000..1ba5b80 --- /dev/null +++ b/tests/data/profdata/llvm-23/same-name-4.proftext @@ -0,0 +1,16 @@ +_Z3bari:40602:2874 + 1: 2874 +_Z3fooi:15422:1220 + 1: 1220 +main:368038:0 + 4: 1068 + 4.2: 1068 + 5: 2150 + 5.1: 2150 + 6: 4160 + 7: 1068 + 9: 4128 _Z3bari:2942 _Z3fooi:1262 + 10: inline1:2000 + 1: 2000 + 10: inline2:4000 + 1: 4000 diff --git a/tests/data/profdata/llvm-23/sample-empty-lines.proftext b/tests/data/profdata/llvm-23/sample-empty-lines.proftext new file mode 100644 index 0000000..800876f --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-empty-lines.proftext @@ -0,0 +1,9 @@ +main:10:1 + 2: 3 + + + 3: inline1:5 + + 4: 1 + + diff --git a/tests/data/profdata/llvm-23/sample-flatten-profile-cs.proftext b/tests/data/profdata/llvm-23/sample-flatten-profile-cs.proftext new file mode 100644 index 0000000..5cd880b --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-flatten-profile-cs.proftext @@ -0,0 +1,20 @@ +[baz]:150:10 + 1: 10 + 3: 20 + 5: 20 foo:20 +[foo]:102:1 + 1: 1 + 3: 1 +[main]:91:1 + 4: 1 + 4.2: 1 + 7: 1 + 9: 3 bar:2 foo:1 + 10: 3 baz:2 foo:1 +[main:10 @ foo]:2:1 + 3: 1 bar:1 + 4: 1 +[bar]:1:1 + 1: 1 +[main:10 @ foo:3 @ bar]:1:1 + 1: 1 diff --git a/tests/data/profdata/llvm-23/sample-flatten-profile.proftext b/tests/data/profdata/llvm-23/sample-flatten-profile.proftext new file mode 100644 index 0000000..51be9e2 --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-flatten-profile.proftext @@ -0,0 +1,49 @@ +baz:160:10 + 1: 10 + 3: 20 + 4: 21 qux:5 quux:6 corge:10 + 4.1: 12 quux:3 grault:4 thud:5 + 5: foo:30 + 1: 20 + 3: bar:10 + 1: 10 + !CFGChecksum: 4 + !Attributes: 4 + !CFGChecksum: 3 + !Attributes: 3 + !CFGChecksum: 1 + !Attributes: 1 +main:110:1 + 4: 1 + 4.2: 1 + 7: 1 + 9: 3 bar:2 foo:1 + 10: foo:2 + 4: 1 + 3: bar:1 + 1: 1 + !CFGChecksum: 4 + !Attributes: 4 + !CFGChecksum: 3 + !Attributes: 3 + 10: baz:20 + 4: 15 qux:3 quux:7 corge:5 + 10: 1 + 6: bar:3 + 1: 2 + 7: 1 + !CFGChecksum: 4 + !Attributes: 4 + !CFGChecksum: 1 + !Attributes: 1 + !CFGChecksum: 2 + !Attributes: 2 +foo:102:1 + 1: 1 + 3: 1 + !CFGChecksum: 3 + !Attributes: 3 +bar:1:1 + 1: 1 + !CFGChecksum: 4 + !Attributes: 4 diff --git a/tests/data/profdata/llvm-23/sample-fs.proftext b/tests/data/profdata/llvm-23/sample-fs.proftext new file mode 100644 index 0000000..c890752 --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-fs.proftext @@ -0,0 +1,7 @@ +main:6436:0 + 4: 534 + 4.2: 534 + 4.738209026: 1068 + 5: 1075 + 5.1: 1075 + 5.738209025: 2150 diff --git a/tests/data/profdata/llvm-23/sample-hot-func-list.proftext b/tests/data/profdata/llvm-23/sample-hot-func-list.proftext new file mode 100644 index 0000000..6e00603 --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-hot-func-list.proftext @@ -0,0 +1,41 @@ +_Z3bari:20301:1437 + 1: 1437 +_Z3fooi:7711:610 + 1: 610 +main:184019:0 + 4: 534 + 4.2: 534 + 5: 1075 + 5.1: 1075 + 6: 2080 + 7: 534 + 9: 2300 _Z3bari:1471 _Z3fooi:631 + 10: inline1:1000 + 1: 1000 + 10: inline2:2000 + 1: 2000 +_Z3bazi:20305:1000 + 1: 1000 +Func1:1523:169 + 1: 169 + 7: 563 +Func2:17043:1594 + 1: 1594 + 3: 1594 + 6: 2009 Func1:150 Func3:1789 + 13: 3105 + 17: 3105 + 19: 1594 +Func3:97401:3035 + 1: 3035 + 5: 7344 + 9: 10640 + 11: 10640 + 15: 3035 +Func4:465:210 + 1: 210 +Func5:6948:470 + 1: 470 + 3: 3507 +Func6:310:102 + 1: 102 diff --git a/tests/data/profdata/llvm-23/sample-multiple-nametables.profdata b/tests/data/profdata/llvm-23/sample-multiple-nametables.profdata new file mode 100644 index 0000000000000000000000000000000000000000..0b31d386e8ce2ca930437d578fb181052659aec5 GIT binary patch literal 165 zcmZp9a$)0_lT%g%r!zA^027o3Q6RA*C|?muqsvc*igQ9~1t<-p=0F)Rc@{w^P=W$u VC~$!S#{W>j$;iaW%)-dP008SfMm01JDGhm4JS+?Q~+iUF8Th{1p;%qxtRqf_$?4%T+qt~ zBoEBunIORQV7U;GY}hJsfuDK7A-TESECYBPRq~FWXR0R$;?YNgwjR~xrv#1 z3=Axn=W?^NFic}%U||9htPGnu7+4vB1RKKw0S0!E1SbQ~Sq%HR8NahIaWOExU}t1x xc)`xVz{S9Pfgi}ez|X+I$igs}o8jy{Mj#)^V0gsBINt`yegq6|U;r`l0svM#PiFuC literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/thinlto_indirect_call_promotion.profraw b/tests/data/profdata/llvm-23/thinlto_indirect_call_promotion.profraw new file mode 100644 index 0000000000000000000000000000000000000000..84707ba2070a92b8683010d9daaef747df35f9ac GIT binary patch literal 528 zcmZoHO3N=Q$obF700xW@ih+Rz#(>i3d^BkWXQ;q~{}8~jee0hktN#DrJkOIkI+TF{ zX0YI^%?f`vOg;fr_5L!KFBeQb%shva5cM!VOdpINJ<~YH=c-N(O#cd~eK7d|0{XA2 zYFH&6%DWHJCbaDydjXpM1gQQWo?dWwGr?0yS0{Tm3_5AzQ$ z+Q7KtR(HRVzu%dYp1!6!$!AXbT=MqY*4O{3u}gA_;W2kfsb$ZfsH;9ZvV7_@)#;23 r{WSu+S$HaLo%TI*hM9pynsFJ}wH81UW(Uaqj8G0Nd|-00@P_dLvBrhT literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/unknown.section.compressed.extbin.profdata b/tests/data/profdata/llvm-23/unknown.section.compressed.extbin.profdata new file mode 100644 index 0000000000000000000000000000000000000000..f08c7ba3d562d03aedeabcd4fab06e213cf50c42 GIT binary patch literal 401 zcmZp9a$)0_lT%g%r?WFa03#ax3CfRz(oAUb-cSt!P;q-S`Dmy-H&mPjO}+&x&kGe- zK$A~{%F98;nbG87`k}%MtZ4ERq55I+mEje)epk%>`M5NVEzPZwv(AC-aZ{X`Kxu*) ze@E4Z7!DWHoT&__WhXJ8o*T}1`tC)h(|e5=PS=_<2g?78YFfd2JICQluYJNRzsiPlXU-%uFtDCrT+YY|AnL#@9uW0l zxe$nI*eU^*J0u5|JFfzkyQ2k`du0HY`)&rJKK!)=Q5&||fT$aPz|@^)TM%zs3z*su dp%`-$GxI=>__tAvnTZjofC1zeaCiXS2moGkN`3$U literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/vp-malform.proftext b/tests/data/profdata/llvm-23/vp-malform.proftext new file mode 100644 index 0000000..2db3096 --- /dev/null +++ b/tests/data/profdata/llvm-23/vp-malform.proftext @@ -0,0 +1,42 @@ +foo +# Func Hash: +10 +# Num Counters: +2 +# Counter Values: +999000 +359800 + +foo2 +# Func Hash: +10 +# Num Counters: +2 +# Counter Values: +1001000 +360200 + +main +# Func Hash: +16650 +# Num Counters: +4 +# Counter Values: +2 +2000 +2000000 +999000 +# NumValueKinds +1 +# Value Kind IPVK_IndirectCallTarget +0 +# NumSites +3 +# Values for each site +0 +2 +# !!!! Malformed Value/Count pair +foo+100 +foo2:1000 +1 +foo2:20000 diff --git a/tests/data/profdata/llvm-23/vp-malform2.proftext b/tests/data/profdata/llvm-23/vp-malform2.proftext new file mode 100644 index 0000000..02ed5a9 --- /dev/null +++ b/tests/data/profdata/llvm-23/vp-malform2.proftext @@ -0,0 +1,32 @@ +foo +# Func Hash: +10 +# Num Counters: +2 +# Counter Values: +999000 +359800 + +main +# Func Hash: +16650 +# Num Counters: +4 +# Counter Values: +2 +2000 +2000000 +999000 +# NumValueKinds +1 +# Value Kind IPVK_IndirectCallTarget +0 +# NumSites +3 +# Values for each site +0 +# !! Malformed value site, missing one value +2 +foo:100 +1 +foo2:20000 diff --git a/tests/data/profdata/llvm-23/vp-truncate.proftext b/tests/data/profdata/llvm-23/vp-truncate.proftext new file mode 100644 index 0000000..98b4b57 --- /dev/null +++ b/tests/data/profdata/llvm-23/vp-truncate.proftext @@ -0,0 +1,36 @@ +foo +# Func Hash: +10 +# Num Counters: +2 +# Counter Values: +999000 +359800 + +foo2 +# Func Hash: +10 +# Num Counters: +2 +# Counter Values: +1001000 +360200 + +main +# Func Hash: +16650 +# Num Counters: +4 +# Counter Values: +2 +2000 +2000000 +999000 +# NumValueKinds +1 +# Value Kind IPVK_IndirectCallTarget +0 +# NumSites +3 +# Values for each site +0 diff --git a/tests/data/profdata/llvm-23/vtable-value-prof.proftext b/tests/data/profdata/llvm-23/vtable-value-prof.proftext new file mode 100644 index 0000000..372f9f9 --- /dev/null +++ b/tests/data/profdata/llvm-23/vtable-value-prof.proftext @@ -0,0 +1,74 @@ +# IR level Instrumentation Flag +:ir +_Z10createTypei +# Func Hash: +146835647075900052 +# Num Counters: +2 +# Counter Values: +750 +250 + +_ZN8Derived15func1Eii +# Func Hash: +742261418966908927 +# Num Counters: +1 +# Counter Values: +250 + +_ZN8Derived15func2Eii +# Func Hash: +742261418966908927 +# Num Counters: +1 +# Counter Values: +250 + +main +# Func Hash: +1124236338992350536 +# Num Counters: +2 +# Counter Values: +1000 +1 +# Num Value Kinds: +2 +# ValueKind = IPVK_IndirectCallTarget: +0 +# NumValueSites: +2 +2 +vtable_prof.cc;_ZN12_GLOBAL__N_18Derived25func1Eii:750 +_ZN8Derived15func1Eii:250 +2 +vtable_prof.cc;_ZN12_GLOBAL__N_18Derived25func2Eii:750 +_ZN8Derived15func2Eii:250 +# ValueKind = IPVK_VTableTarget: +2 +# NumValueSites: +2 +2 +vtable_prof.cc;_ZTVN12_GLOBAL__N_18Derived2E:750 +_ZTV8Derived1:250 +2 +vtable_prof.cc;_ZTVN12_GLOBAL__N_18Derived2E:750 +_ZTV8Derived1:250 + +vtable_prof.cc;_ZN12_GLOBAL__N_18Derived25func1Eii +# Func Hash: +742261418966908927 +# Num Counters: +1 +# Counter Values: +750 + +vtable_prof.cc;_ZN12_GLOBAL__N_18Derived25func2Eii +# Func Hash: +742261418966908927 +# Num Counters: +1 +# Counter Values: +750 + diff --git a/tests/data/profdata/llvm-23/weight-instr-bar.profdata b/tests/data/profdata/llvm-23/weight-instr-bar.profdata new file mode 100644 index 0000000000000000000000000000000000000000..4ed07660f654090e750b19be4e0af609bc1c61db GIT binary patch literal 1320 zcmeyLQ&5zjmf6V600ExHYmK2yFeL$%U}Tt_rlBWzFff!ADy;yeON$fJQ=x1IMi>K1 zb3kcEhBbR7Zu=bi5d*Wx04kG~pWnpK1 zb3kcEhBbR7Zu=bi5d*Wx04kG~pWnpjI*ICuRlWs>LPl7M$03g{ F3;+VlD0u(? literal 0 HcmV?d00001 diff --git a/tests/data/profdata/llvm-23/weight-sample-bar.proftext b/tests/data/profdata/llvm-23/weight-sample-bar.proftext new file mode 100644 index 0000000..a910f74 --- /dev/null +++ b/tests/data/profdata/llvm-23/weight-sample-bar.proftext @@ -0,0 +1,8 @@ +bar:1772037:35370 + 17: 35370 + 18: 35370 + 19: 7005 + 20: 29407 + 21: 12170 + 23: 18150 bar:19829 + 25: 36666 diff --git a/tests/data/profdata/llvm-23/weight-sample-foo.proftext b/tests/data/profdata/llvm-23/weight-sample-foo.proftext new file mode 100644 index 0000000..155ec5d --- /dev/null +++ b/tests/data/profdata/llvm-23/weight-sample-foo.proftext @@ -0,0 +1,8 @@ +foo:1763288:35327 + 7: 35327 + 8: 35327 + 9: 6930 + 10: 29341 + 11: 11906 + 13: 18185 foo:19531 + 15: 36458 diff --git a/tests/data/profdata/misc/v11_uniform_counters.profraw b/tests/data/profdata/misc/v11_uniform_counters.profraw new file mode 100644 index 0000000000000000000000000000000000000000..5b10c5671a4f706b66c3178e74da00d87298ab49 GIT binary patch literal 432 zcmZoHO3N=Q$obFBfC`vUxeTmmd~`0l`W;XOeo%U1FN861Ere!ds4x3g50ylsVCHme z3ZAl}v>{)McOUbG>0iFhfa*t5ij@h|50gB1`M+^@I)K(sPLe2`z6bFrm=nMsg)exh4oLA*top> = LazyLock::new(|| { (21, "1.91"), #[cfg(feature = "__llvm_22")] (22, "nightly-2026-02-15"), + #[cfg(feature = "__llvm_23")] + (23, "nightly-2026-08-08"), ]); // Install all the versions we care about. @@ -108,7 +110,7 @@ static SUPPORTED_LLVM_VERSIONS: LazyLock> = LazyLock::new(|| { map }); -static LATEST_SUPPORTED_VERSION: u8 = 22; +static LATEST_SUPPORTED_VERSION: u8 = 23; #[test] // this test is 'heavy', since it downloads a new toolchain each day. @@ -505,3 +507,39 @@ fn hash_table_regression_check() { // correctly to prevent a regression. parse(&ferrocene).unwrap(); } + +// Raw profile version 11 places the uniform counter section between the bitmap and the names, +// so a parser that jumps straight from the counters to the names starts reading names from +// inside the uniform counter data. LLVM only emits that section in some configurations, so a +// profile captured from a normal build has NumUniformCounters == 0 and cannot catch this. +// +// This fixture is a real v11 profraw (rustc 1.99.0-nightly 771916f90, LLVM 23.1.0) with two +// uniform counters spliced in and the three v11 header fields set to match, following the +// layout compiler-rt writes in lprofWriteDataImpl. Before the section was skipped this input +// panicked in util.rs with "range end index 197877615 out of range for slice of length 90", +// because the name length prefix was read out of the uniform counter payload. +#[test] +fn v11_uniform_counter_section_is_skipped() { + let raw = data_root_dir() + .join("misc") + .join("v11_uniform_counters.profraw"); + + let profile = parse(&raw).unwrap(); + + let names = profile + .symtab + .iter() + .map(|(_, name)| name.to_string()) + .collect::>(); + + // Both symbols sit after the uniform counter section, so any drift in the skip corrupts + // them rather than merely shifting them. + assert!( + names.contains("_RNvCs9Ov4RGoaFQp_8v11probe7covered"), + "expected instrumented function missing, got {names:?}" + ); + assert!( + names.contains("_RNvNtCs9Ov4RGoaFQp_8v11probe5testss_1t"), + "expected test function missing, got {names:?}" + ); +}