[PATCH] D101937: [Clang][Manual] Mention -fdebug-info-for-profiling.

Michael Benfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 5 12:53:39 PDT 2021


mbenfield created this revision.
mbenfield added reviewers: rsmith, wmi.
Herald added a subscriber: wenlei.
mbenfield requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This option is necessary for effective AutoFDO, and it also seems that
the `create_llvm_prof` converter won't work if the binary is compiled
without it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101937

Files:
  clang/docs/UsersManual.rst


Index: clang/docs/UsersManual.rst
===================================================================
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -1911,14 +1911,16 @@
 usual build cycle when using sample profilers for optimization:
 
 1. Build the code with source line table information. You can use all the
-   usual build flags that you always build your application with. The only
-   requirement is that you add ``-gline-tables-only`` or ``-g`` to the
-   command line. This is important for the profiler to be able to map
-   instructions back to source line locations.
+   usual build flags that you always build your application with. There are two
+   flags you must use. The first is ``-gline-tables-only`` or ``-g``. This is
+   important for the profiler to be able to map instructions back to source line
+   locations. The second is ``-fdebug-info-for-profiling``. This will add
+   discriminators so that different expressions on the same source line can be
+   distinguished, as well as some other changes making profiling more effective.
 
    .. code-block:: console
 
-     $ clang++ -O2 -gline-tables-only code.cc -o code
+     $ clang++ -O2 -fdebug-info-for-profiling -gline-tables-only code.cc -o code
 
 2. Run the executable under a sampling profiler. The specific profiler
    you use does not really matter, as long as its output can be converted


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101937.343152.patch
Type: text/x-patch
Size: 1394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210505/69a42dd8/attachment.bin>


More information about the cfe-commits mailing list