diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst --- a/clang/docs/UsersManual.rst +++ b/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