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 2ae86fc..004c6e5 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, } @@ -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 { @@ -392,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 { @@ -478,6 +521,22 @@ 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 +576,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 +616,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 +634,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 +655,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, }, )) 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 0000000..d492076 Binary files /dev/null and b/tests/data/profdata/llvm-23/basic-histogram.memprofraw differ diff --git a/tests/data/profdata/llvm-23/basic.memprofraw b/tests/data/profdata/llvm-23/basic.memprofraw new file mode 100644 index 0000000..6943c18 Binary files /dev/null and b/tests/data/profdata/llvm-23/basic.memprofraw differ diff --git a/tests/data/profdata/llvm-23/basic.profraw b/tests/data/profdata/llvm-23/basic.profraw new file mode 100644 index 0000000..1b284b8 Binary files /dev/null and b/tests/data/profdata/llvm-23/basic.profraw differ 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 0000000..62b7d29 Binary files /dev/null and b/tests/data/profdata/llvm-23/basic_v3.memprofraw differ diff --git a/tests/data/profdata/llvm-23/basic_v4.memprofraw b/tests/data/profdata/llvm-23/basic_v4.memprofraw new file mode 100644 index 0000000..c3ac49e Binary files /dev/null and b/tests/data/profdata/llvm-23/basic_v4.memprofraw differ diff --git a/tests/data/profdata/llvm-23/buildid.memprofraw b/tests/data/profdata/llvm-23/buildid.memprofraw new file mode 100644 index 0000000..c6aec8d Binary files /dev/null and b/tests/data/profdata/llvm-23/buildid.memprofraw differ 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 0000000..dec9015 Binary files /dev/null and b/tests/data/profdata/llvm-23/c-general.profraw differ diff --git a/tests/data/profdata/llvm-23/clang_profile.proftext b/tests/data/profdata/llvm-23/clang_profile.proftext new file mode 100644 index 0000000..5419d23 --- /dev/null +++ b/tests/data/profdata/llvm-23/clang_profile.proftext @@ -0,0 +1,8 @@ +main +# Func Hash: +0 +# Num Counters: +1 +# Counter Values: +1 + diff --git a/tests/data/profdata/llvm-23/compat.profdata.v1 b/tests/data/profdata/llvm-23/compat.profdata.v1 new file mode 100644 index 0000000..fd17459 Binary files /dev/null and b/tests/data/profdata/llvm-23/compat.profdata.v1 differ 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 0000000..c331e30 Binary files /dev/null and b/tests/data/profdata/llvm-23/compat.profdata.v10 differ diff --git a/tests/data/profdata/llvm-23/compat.profdata.v2 b/tests/data/profdata/llvm-23/compat.profdata.v2 new file mode 100644 index 0000000..9698675 Binary files /dev/null and b/tests/data/profdata/llvm-23/compat.profdata.v2 differ 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 0000000..7db0d1d Binary files /dev/null and b/tests/data/profdata/llvm-23/compat.profdata.v4 differ diff --git a/tests/data/profdata/llvm-23/compressed.profraw b/tests/data/profdata/llvm-23/compressed.profraw new file mode 100644 index 0000000..778e80f Binary files /dev/null and b/tests/data/profdata/llvm-23/compressed.profraw differ 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 0000000..681bcec Binary files /dev/null and b/tests/data/profdata/llvm-23/function-entry-coverage.profdata differ 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 0000000..8958af9 Binary files /dev/null and b/tests/data/profdata/llvm-23/inline.memprofraw differ 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 0000000..3952768 Binary files /dev/null and b/tests/data/profdata/llvm-23/multi.memprofraw differ 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 0000000..df6fcb1 Binary files /dev/null and b/tests/data/profdata/llvm-23/padding-histogram.memprofraw differ diff --git a/tests/data/profdata/llvm-23/pic.memprofraw b/tests/data/profdata/llvm-23/pic.memprofraw new file mode 100644 index 0000000..b6a733a Binary files /dev/null and b/tests/data/profdata/llvm-23/pic.memprofraw differ 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 0000000..0b31d38 Binary files /dev/null and b/tests/data/profdata/llvm-23/sample-multiple-nametables.profdata differ diff --git a/tests/data/profdata/llvm-23/sample-nametable-after-samples.profdata b/tests/data/profdata/llvm-23/sample-nametable-after-samples.profdata new file mode 100644 index 0000000..76f19bb Binary files /dev/null and b/tests/data/profdata/llvm-23/sample-nametable-after-samples.profdata differ diff --git a/tests/data/profdata/llvm-23/sample-nametable-empty-string.profdata b/tests/data/profdata/llvm-23/sample-nametable-empty-string.profdata new file mode 100644 index 0000000..16f9b31 Binary files /dev/null and b/tests/data/profdata/llvm-23/sample-nametable-empty-string.profdata differ diff --git a/tests/data/profdata/llvm-23/sample-overlap-0.proftext b/tests/data/profdata/llvm-23/sample-overlap-0.proftext new file mode 100644 index 0000000..33fce64 --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-overlap-0.proftext @@ -0,0 +1,18 @@ +_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 +_Z3bazi:20301:1000 + 1: 1000 diff --git a/tests/data/profdata/llvm-23/sample-overlap-1.proftext b/tests/data/profdata/llvm-23/sample-overlap-1.proftext new file mode 100644 index 0000000..3f3f4c1 --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-overlap-1.proftext @@ -0,0 +1,18 @@ +_Z3bari:203010:14370 + 1: 14370 +_Z3fooi:77110:6100 + 1: 6100 +main:1840190:0 + 4: 5340 + 4.2: 5340 + 5: 10750 + 5.1: 10750 + 6: 20800 + 7: 5340 + 9: 20640 _Z3bari:14710 _Z3fooi:6310 + 10: inline1:10000 + 1: 10000 + 10: inline2:20000 + 1: 20000 +_Z3bazi:203010:10000 + 1: 10000 diff --git a/tests/data/profdata/llvm-23/sample-overlap-2.proftext b/tests/data/profdata/llvm-23/sample-overlap-2.proftext new file mode 100644 index 0000000..e342012 --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-overlap-2.proftext @@ -0,0 +1,18 @@ +_Z3bari:20301:1437 + 1: 1437 +_Z3fooi:7711:610 + 1: 610 +main:18401:0 + 4: 53 + 4.2: 53 + 5: 107 + 5.1: 107 + 6: 208 + 7: 53 + 9: 206 _Z3bari:1471 _Z3fooi:631 + 10: inline1:100 + 1: 100 + 10: inline2:200 + 1: 200 +_Z3bazi:20301:1000 + 1: 1000 diff --git a/tests/data/profdata/llvm-23/sample-overlap-3.proftext b/tests/data/profdata/llvm-23/sample-overlap-3.proftext new file mode 100644 index 0000000..b701511 --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-overlap-3.proftext @@ -0,0 +1,18 @@ +_Z3bari:20301:1437 + 1: 1437 +_Z3fooi2:7711:610 + 1: 610 +main2: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 +_Z3bazi:20301:1000 + 1: 100 diff --git a/tests/data/profdata/llvm-23/sample-overlap-4.proftext b/tests/data/profdata/llvm-23/sample-overlap-4.proftext new file mode 100644 index 0000000..5421d56 --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-overlap-4.proftext @@ -0,0 +1,18 @@ +_Z3bari:20301:1437 + 2: 1437 +_Z3fooi:7711:610 + 2: 610 +main:184019:0 + 5: 534 + 5.2: 534 + 6: 1075 + 6.1: 1075 + 7: 208 + 8: 534 + 10: 206 _Z3bari:1471 _Z3fooi:631 + 11: inline1:1000 + 1: 1000 + 11: inline2:2000 + 1: 2000 +_Z3bazi:20301:1000 + 2: 1000 diff --git a/tests/data/profdata/llvm-23/sample-overlap-5.proftext b/tests/data/profdata/llvm-23/sample-overlap-5.proftext new file mode 100644 index 0000000..1bcd3ce --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-overlap-5.proftext @@ -0,0 +1,18 @@ +_Z3bari:0:0 + 1: 0 +_Z3fooi:0:0 + 1: 0 +main:0:0 + 4: 0 + 4.2: 0 + 5: 0 + 5.1: 0 + 6: 0 + 7: 0 + 9: 0 + 10: inline1:0 + 1: 0 + 10: inline2:0 + 1: 0 +_Z3bazi:0:0 + 1: 0 diff --git a/tests/data/profdata/llvm-23/sample-profile-ext.proftext b/tests/data/profdata/llvm-23/sample-profile-ext.proftext new file mode 100644 index 0000000..100133f --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-profile-ext.proftext @@ -0,0 +1,18 @@ +main:184019:0 + 4: 534 + 4.2: 534 + 5: 1075 + 5.1: 1075 + 6: 2080 + 7: 534 + 9: 2064 _Z3bari:1471 _Z3fooi:631 + 9: vtables _ZTVbar:1471 _ZTVfoo:630 + 10: inline1:1000 + 1: 1000 + 10: inline2:2000 + 1: 2000 + 10: vtables _ZTVinline1:1000 _ZTVinline2:2000 +_Z3bari:20301:1437 + 1: 1437 +_Z3fooi:7711:610 + 1: 610 diff --git a/tests/data/profdata/llvm-23/sample-profile.proftext b/tests/data/profdata/llvm-23/sample-profile.proftext new file mode 100644 index 0000000..f9f87df --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-profile.proftext @@ -0,0 +1,16 @@ +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 +_Z3bari:20301:1437 + 1: 1437 +_Z3fooi:7711:610 + 1: 610 diff --git a/tests/data/profdata/llvm-23/sample-remap.proftext b/tests/data/profdata/llvm-23/sample-remap.proftext new file mode 100644 index 0000000..33fce64 --- /dev/null +++ b/tests/data/profdata/llvm-23/sample-remap.proftext @@ -0,0 +1,18 @@ +_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 +_Z3bazi:20301:1000 + 1: 1000 diff --git a/tests/data/profdata/llvm-23/split-layout.profdata b/tests/data/profdata/llvm-23/split-layout.profdata new file mode 100644 index 0000000..bc473ae Binary files /dev/null and b/tests/data/profdata/llvm-23/split-layout.profdata differ 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 0000000..84707ba Binary files /dev/null and b/tests/data/profdata/llvm-23/thinlto_indirect_call_promotion.profraw differ 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 0000000..f08c7ba Binary files /dev/null and b/tests/data/profdata/llvm-23/unknown.section.compressed.extbin.profdata differ diff --git a/tests/data/profdata/llvm-23/unknown.section.extbin.profdata b/tests/data/profdata/llvm-23/unknown.section.extbin.profdata new file mode 100644 index 0000000..b7d0ddb Binary files /dev/null and b/tests/data/profdata/llvm-23/unknown.section.extbin.profdata differ 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 0000000..4ed0766 Binary files /dev/null and b/tests/data/profdata/llvm-23/weight-instr-bar.profdata differ diff --git a/tests/data/profdata/llvm-23/weight-instr-foo.profdata b/tests/data/profdata/llvm-23/weight-instr-foo.profdata new file mode 100644 index 0000000..581ef39 Binary files /dev/null and b/tests/data/profdata/llvm-23/weight-instr-foo.profdata differ 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 0000000..5b10c56 Binary files /dev/null and b/tests/data/profdata/misc/v11_uniform_counters.profraw differ diff --git a/tests/profdata.rs b/tests/profdata.rs index bbe8883..6cf3f66 100644 --- a/tests/profdata.rs +++ b/tests/profdata.rs @@ -85,6 +85,8 @@ static SUPPORTED_LLVM_VERSIONS: LazyLock> = 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:?}" + ); +}