[all-commits] [llvm/llvm-project] 07c918: [PGO] Exposing PGO's Counter Reset and File Dumpin...

Qiongsi Wu via All-commits all-commits at lists.llvm.org
Tue Jan 9 07:38:32 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 07c9189fcc063bdf6219d2733843c89cde3991e1
      https://github.com/llvm/llvm-project/commit/07c9189fcc063bdf6219d2733843c89cde3991e1
  Author: Qiongsi Wu <274595+qiongsiwu at users.noreply.github.com>
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
    M clang/docs/UsersManual.rst
    M clang/include/clang/Basic/CodeGenOptions.h
    M clang/include/clang/Frontend/Utils.h
    M clang/lib/Frontend/CompilerInstance.cpp
    M clang/lib/Frontend/InitPreprocessor.cpp
    M clang/test/Profile/c-general.c
    M compiler-rt/include/CMakeLists.txt
    A compiler-rt/include/profile/instr_prof_interface.h
    M compiler-rt/lib/profile/InstrProfiling.h
    A compiler-rt/test/profile/Linux/instrprof-weak-symbol.c
    A compiler-rt/test/profile/instrprof-api.c

  Log Message:
  -----------
  [PGO] Exposing PGO's Counter Reset and File Dumping APIs (#76471)

This PR exposes four PGO functions 

- `__llvm_profile_set_filename`
- `__llvm_profile_reset_counters`, 
- `__llvm_profile_dump` 
- `__llvm_orderfile_dump` 

to user programs through the new header `instr_prof_interface.h` under
`compiler-rt/include/profile`. This way, the user can include the header
`profile/instr_prof_interface.h` to introduce these four names to their
programs.

Additionally, this PR defines macro `__LLVM_INSTR_PROFILE_GENERATE` when
the program is compiled with profile generation, and defines macro
`__LLVM_INSTR_PROFILE_USE` when the program is compiled with profile
use. `__LLVM_INSTR_PROFILE_GENERATE` together with
`instr_prof_interface.h` define the PGO functions only when the program
is compiled with profile generation. When profile generation is off,
these PGO functions are defined away and leave no trace in the user's
program.

Background:
https://discourse.llvm.org/t/pgo-are-the-llvm-profile-functions-stable-c-apis-across-llvm-releases/75832




More information about the All-commits mailing list