[memprof] Fix a typo in writeMemProfV1 (#87890)

This patch borrows memprof-merge.test to test --memprof-version.
This commit is contained in:
Kazu Hirata
2024-04-07 15:06:13 -07:00
committed by GitHub
parent 649523f6f7
commit 4d1bb7699b
2 changed files with 23 additions and 1 deletions

View File

@@ -493,7 +493,7 @@ static Error writeMemProfV1(
llvm::MapVector<GlobalValue::GUID, memprof::IndexedMemProfRecord>
&MemProfRecordData,
llvm::MapVector<memprof::FrameId, memprof::Frame> &MemProfFrameData) {
OS.write(memprof::Version0);
OS.write(memprof::Version1);
uint64_t HeaderUpdatePos = OS.tell();
OS.write(0ULL); // Reserve space for the memprof record table offset.
OS.write(0ULL); // Reserve space for the memprof frame payload offset.

View File

@@ -0,0 +1,22 @@
REQUIRES: x86_64-linux
RUN: echo ":ir" > %t.proftext
RUN: echo "main" >> %t.proftext
RUN: echo "742261418966908927" >> %t.proftext
RUN: echo "1" >> %t.proftext
RUN: echo "1" >> %t.proftext
To update the inputs used below run Inputs/update_memprof_inputs.sh /path/to/updated/clang
RUN: llvm-profdata merge %t.proftext %p/Inputs/basic.memprofraw --memprof-version=0 --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof.v0
RUN: llvm-profdata show %t.prof.v0 | FileCheck %s
RUN: llvm-profdata merge %t.proftext %p/Inputs/basic.memprofraw --memprof-version=1 --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof.v1
RUN: llvm-profdata show %t.prof.v1 | FileCheck %s
For now we only check the validity of the instrumented profile since we don't
have a way to display the contents of the memprof indexed format yet.
CHECK: Instrumentation level: IR entry_first = 0
CHECK: Total functions: 1
CHECK: Maximum function count: 1
CHECK: Maximum internal block count: 0