summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2019-03-04 20:21:31 +0000
committerRong Xu <xur@google.com>2019-03-04 20:21:31 +0000
commit22faaea9697edcede1318f0f2afd5336df935d16 (patch)
tree9c6f22ee7afa29e5de3de0beb4fdb01b6bdded59 /docs
parent24400dafe16716f28cd0e7e5fa6e004c0e50686a (diff)
downloadclang-22faaea9697edcede1318f0f2afd5336df935d16.tar.gz
[PGO] Clang part of change for context-sensitive PGO (part1)
Part 1 of CSPGO change in Clang. This includes changes in clang options and calls to llvm PassManager. Tests will be committed in part2. This change needs the PassManager change in llvm. Differential Revision: https://reviews.llvm.org/D54176 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355331 91177308-0d34-0410-b5e6-96231b3b80d8
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