[all-commits] [llvm/llvm-project] 16e74f: Reland "[TypeProf][InstrPGO] Introduce raw and ins...

Mingming Liu via All-commits all-commits at lists.llvm.org
Tue Feb 27 11:07:51 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 16e74fd48988ac95551d0f64e1b36f78a82a89a2
      https://github.com/llvm/llvm-project/commit/16e74fd48988ac95551d0f64e1b36f78a82a89a2
  Author: Mingming Liu <mingmingl at google.com>
  Date:   2024-02-27 (Tue, 27 Feb 2024)

  Changed paths:
    M compiler-rt/include/profile/InstrProfData.inc
    M compiler-rt/lib/profile/InstrProfiling.h
    M compiler-rt/lib/profile/InstrProfilingBuffer.c
    M compiler-rt/lib/profile/InstrProfilingFile.c
    M compiler-rt/lib/profile/InstrProfilingInternal.h
    M compiler-rt/lib/profile/InstrProfilingMerge.c
    M compiler-rt/lib/profile/InstrProfilingPlatformAIX.c
    M compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c
    M compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
    M compiler-rt/lib/profile/InstrProfilingPlatformOther.c
    M compiler-rt/lib/profile/InstrProfilingPlatformWindows.c
    M compiler-rt/lib/profile/InstrProfilingWriter.c
    M compiler-rt/test/profile/instrprof-write-buffer-internal.c
    M llvm/include/llvm/ProfileData/InstrProf.h
    M llvm/include/llvm/ProfileData/InstrProfData.inc
    M llvm/include/llvm/ProfileData/InstrProfReader.h
    M llvm/lib/ProfileData/InstrProf.cpp
    M llvm/lib/ProfileData/InstrProfReader.cpp
    M llvm/lib/ProfileData/InstrProfWriter.cpp
    M llvm/test/Instrumentation/InstrProfiling/coverage.ll
    M llvm/test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.profraw
    M llvm/test/Transforms/PGOProfile/comdat_internal.ll
    M llvm/test/tools/llvm-profdata/Inputs/c-general.profraw
    M llvm/test/tools/llvm-profdata/Inputs/compressed.profraw
    A llvm/test/tools/llvm-profdata/Inputs/thinlto_indirect_call_promotion.profraw
    M llvm/test/tools/llvm-profdata/binary-ids-padding.test
    M llvm/test/tools/llvm-profdata/large-binary-id-size.test
    M llvm/test/tools/llvm-profdata/malformed-not-space-for-another-header.test
    M llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test
    M llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
    M llvm/test/tools/llvm-profdata/misaligned-binary-ids-size.test
    M llvm/test/tools/llvm-profdata/mismatched-raw-profile-header.test
    M llvm/test/tools/llvm-profdata/raw-32-bits-be.test
    M llvm/test/tools/llvm-profdata/raw-32-bits-le.test
    M llvm/test/tools/llvm-profdata/raw-64-bits-be.test
    M llvm/test/tools/llvm-profdata/raw-64-bits-le.test
    M llvm/test/tools/llvm-profdata/raw-two-profiles.test

  Log Message:
  -----------
  Reland "[TypeProf][InstrPGO] Introduce raw and instr profile format change for type profiling." (#82711)

New change on top of [reviewed
patch](https://github.com/llvm/llvm-project/pull/81691) are [in commits
after this
one](https://github.com/llvm/llvm-project/pull/82711/commits/d0757f46b3e3865b5f7c552bc0744309a363e0ac).
Previous commits are restored from the remote branch with timestamps.

1. Fix build breakage for non-ELF platforms, by defining the missing
functions {`__llvm_profile_begin_vtables`, `__llvm_profile_end_vtables`,
`__llvm_profile_begin_vtabnames `, `__llvm_profile_end_vtabnames`}
everywhere.
* Tested on mac laptop (for darwins) and Windows. Specifically,
functions in `InstrProfilingPlatformWindows.c` returns `NULL` to make it
more explicit that type prof isn't supported; see comments for the
reason.
* For the rest (AIX, other), mostly follow existing examples (like this
[one](https://github.com/llvm/llvm-project/commit/f95b2f1acf1171abb0d00089fd4c9238753847e3))
   
2. Rename `__llvm_prf_vtabnames` -> `__llvm_prf_vns` for shorter section
name, and make returned pointers
[const](https://github.com/llvm/llvm-project/pull/82711/commits/a825d2a4ec00f07772a373091a702f149c3b0c34#diff-4de780ce726d76b7abc9d3353aef95013e7b21e7bda01be8940cc6574fb0b5ffR120-R121)

**Original Description**

* Raw profile format
- Header: records the byte size of compressed vtable names, and the
number of profiled vtable entries (call it `VTableProfData`). Header
also records padded bytes of each section.
- Payload: adds a section for compressed vtable names, and a section to
store `VTableProfData`. Both sections are padded so the size is a
multiple of 8.
* Indexed profile format
  - Header: records the byte offset of compressed vtable names.
- Payload: adds a section to store compressed vtable names. This section
is used by `llvm-profdata` to show the list of vtables profiled for an
instrumented site.
  
[The originally reviewed
patch](https://github.com/llvm/llvm-project/pull/66825) will have
profile reader/write change and llvm-profdata change.
- To ensure this PR has all the necessary profile format change along
with profile version bump, created a copy of the originally reviewed
patch in https://github.com/llvm/llvm-project/pull/80761. The copy
doesn't have profile format change, but it has the set of tests which
covers type profile generation, profile read and profile merge. Tests
pass there.
  
rfc in
https://discourse.llvm.org/t/rfc-dynamic-type-profiling-and-optimizations-in-llvm/74600

---------

Co-authored-by: modiking <modiking213 at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list