Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions clang/docs/UsersManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2780,6 +2780,25 @@ usual build cycle when using sample profilers for optimization:
/clang:-fdebug-info-for-profiling /clang:-funique-internal-linkage-names ^
code.cc /Fe:code /fuse-ld=lld /link /debug:dwarf

[OPTIONAL] Pseudo instrumentation can be used as the anchor for accurate
profile mapping with the ``-fpseudo-probe-for-profiling`` option.
Copy link
Member

@MaskRay MaskRay Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention the relation with -fdebug-info-for-profiling. Can both be used together?

Copy link
Contributor Author

@HaohaiWen HaohaiWen Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-fdebug-info-for-profiling enables discriminator in debug info which is not used when using pseudo probe.
They can be used together if user want to generate probe based profile file and line/discriminator based profile file with same binary. e.g. https://github.com/llvm/llvm-project/blob/main/llvm/test/tools/llvm-profgen/coff-profile.test


On Linux:

.. code-block:: console

$ clang++ -O2 -gline-tables-only \
-fpseudo-probe-for-profiling -funique-internal-linkage-names \
code.cc -o code

On Windows:

.. code-block:: winbatch

> clang-cl /O2 -gdwarf -gline-tables-only ^
-fpseudo-probe-for-profiling /clang:-funique-internal-linkage-names ^
code.cc /Fe:code -fuse-ld=lld /link /debug:dwarf

.. note::

:ref:`-funique-internal-linkage-names <funique_internal_linkage_names>`
Expand Down Expand Up @@ -2879,6 +2898,25 @@ usual build cycle when using sample profilers for optimization:
/clang:-fdebug-info-for-profiling /clang:-funique-internal-linkage-names ^
-fprofile-sample-use=code.prof code.cc /Fe:code -fuse-ld=lld /link /debug:dwarf

[OPTIONAL] Pseudo instrumentation can be used as the anchor for accurate
profile mapping with the ``-fpseudo-probe-for-profiling`` option.

On Linux:

.. code-block:: console

$ clang++ -O2 \
-fpseudo-probe-for-profiling -funique-internal-linkage-names \
-fprofile-sample-use=code.prof code.cc -o code

On Windows:

.. code-block:: winbatch

> clang-cl /O2 ^
-fpseudo-probe-for-profiling /clang:-funique-internal-linkage-names ^
-fprofile-sample-use=code.prof code.cc /Fe:code

[OPTIONAL] Sampling-based profiles can have inaccuracies or missing block/
edge counters. The profile inference algorithm (profi) can be used to infer
missing blocks and edge counts, and improve the quality of profile data.
Expand Down
4 changes: 4 additions & 0 deletions llvm/docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ Changes to the WebAssembly Backend
Changes to the Windows Target
-----------------------------

* `-fpseudo-probe-for-profiling` is now supported for COFF.

Changes to the X86 Backend
--------------------------

Expand All @@ -160,6 +162,8 @@ Changes to the Debug Info
Changes to the LLVM tools
---------------------------------

* `llvm-profgen` now supports decoding pseudo probe for COFF binaries.

* `llvm-readelf` now dumps all hex format values in lower-case mode.
* Some code paths for supporting Python 2.7 in `llvm-lit` have been removed.
* Support for `%T` in lit has been removed.
Expand Down
Loading