summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/UsersManual.rst42
1 files changed, 41 insertions, 1 deletions
diff --git a/docs/UsersManual.rst b/docs/UsersManual.rst
index f004f20909..88cb72c9b6 100644
--- a/docs/UsersManual.rst
+++ b/docs/UsersManual.rst
@@ -1745,7 +1745,8 @@ controlled by the GCC-compatible flags ``-fprofile-generate`` and
``-fprofile-use``. Although these flags are semantically equivalent to
their GCC counterparts, they *do not* handle GCC-compatible profiles.
They are only meant to implement GCC's semantics with respect to
-profile creation and use.
+profile creation and use. Flag ``-fcs-profile-generate`` also instruments
+programs using the same instrumentation method as ``-fprofile-generate``.
.. option:: -fprofile-generate[=<dirname>]
@@ -1778,6 +1779,45 @@ profile creation and use.
``LLVM_PROFILE_FILE`` can still be used to override
the directory and filename for the profile file at runtime.
+.. option:: -fcs-profile-generate[=<dirname>]
+
+ The ``-fcs-profile-generate`` and ``-fcs-profile-generate=`` flags will use
+ the same instrumentation method, and generate the same profile as in the
+ ``-fprofile-generate`` and ``-fprofile-generate=`` flags. The difference is
+ that the instrumentation is performed after inlining so that the resulted
+ profile has a better context sensitive information. They cannot be used
+ together with ``-fprofile-generate`` and ``-fprofile-generate=`` flags.
+ They are typically used in conjunction with ``-fprofile-use`` flag.
+ The profile generated by ``-fcs-profile-generate`` and ``-fprofile-generate``
+ can be merged by llvm-profdata. A use example:
+
+ .. code-block:: console
+
+ $ clang++ -O2 -fprofile-generate=yyy/zzz code.cc -o code
+ $ ./code
+ $ llvm-profdata merge -output=code.profdata yyy/zzz/
+
+ The first few steps are the same as that in ``-fprofile-generate``
+ compilation. Then perform a second round of instrumentation.
+
+ .. code-block:: console
+
+ $ clang++ -O2 -fprofile-use=code.profdata -fcs-profile-generate=sss/ttt \
+ -o cs_code
+ $ ./cs_code
+ $ llvm-profdata merge -output=cs_code.profdata sss/ttt code.profdata
+
+ The resulted ``cs_code.prodata`` combines ``code.profdata`` and the profile
+ generated from binary ``cs_code``. Profile ``cs_code.profata`` can be used by
+ ``-fprofile-use`` compilaton.
+
+ .. code-block:: console
+
+ $ clang++ -O2 -fprofile-use=cs_code.profdata
+
+ The above command will read both profiles to the compiler at the identical
+ point of instrumenations.
+
.. option:: -fprofile-use[=<pathname>]
Without any other arguments, ``-fprofile-use`` behaves identically to