Skip to content
Merged
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
18 changes: 10 additions & 8 deletions clang/docs/UsersManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2778,7 +2778,7 @@ usual build cycle when using sample profilers for optimization:

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

.. note::

Expand Down Expand Up @@ -2861,23 +2861,25 @@ usual build cycle when using sample profilers for optimization:
that executes faster than the original one. Note that you are not
required to build the code with the exact same arguments that you
used in the first step. The only requirement is that you build the code
with the same debug info options and ``-fprofile-sample-use``.
with the same debug info options and ``-fprofile-sample-use``. ``-gdwarf``
and ``-gline-tables-only`` can be omitted if you do not need debug info
in the final binary.

On Linux:

.. code-block:: console

$ clang++ -O2 -gline-tables-only \
$ clang++ -O2 \
-fdebug-info-for-profiling -funique-internal-linkage-names \
-fprofile-sample-use=code.prof code.cc -o code

On Windows:

.. code-block:: winbatch

> clang-cl /O2 -gdwarf -gline-tables-only ^
> clang-cl /O2 ^
/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
-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
Expand All @@ -2886,17 +2888,17 @@ usual build cycle when using sample profilers for optimization:

.. code-block:: console

$ clang++ -fsample-profile-use-profi -O2 -gline-tables-only \
$ clang++ -fsample-profile-use-profi -O2 \
-fdebug-info-for-profiling -funique-internal-linkage-names \
-fprofile-sample-use=code.prof code.cc -o code

On Windows:

.. code-block:: winbatch

> clang-cl /clang:-fsample-profile-use-profi /O2 -gdwarf -gline-tables-only ^
> clang-cl /clang:-fsample-profile-use-profi /O2 ^
/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
-fprofile-sample-use=code.prof code.cc /Fe:code

Sample Profile Formats
""""""""""""""""""""""
Expand Down
Loading