[PGO] Directory name stripping in global identifier for static functions
authorRong Xu <xur@google.com>
Sat, 25 Feb 2017 00:00:36 +0000 (00:00 +0000)
committerRong Xu <xur@google.com>
Sat, 25 Feb 2017 00:00:36 +0000 (00:00 +0000)
commitdd2b6c53e8a507af2ee9cc21a099d01701d15a32
tree01c5ce69591abfe03e9a33460b5c8f7aa0f99b24
parent16f0a906631b891cf89eb99cbc195a30411e6380
[PGO] Directory name stripping in global identifier for static functions

Current internal option -static-func-full-module-prefix keeps all the
directory path the profile counter names for static functions. The default
of this option is false. This strips the directory names from the source
filename which is problematic:

(1) it creates linker errors for profile-generation compilation, exposed in
our internal benchmarks. We are seeing messages like
"warning: relocation refers to discarded section".
This is due to the name conflicts after the stripping.

(2) the stripping only applies to getPGOFuncName.
Current Thin-LTO module importing for the indirect-calls assumes
the source directory name not being stripped. Current default value
for this option can potentially prevent some inter-module
indirect-call-promotions.

This patch turns the default value for -static-func-full-module-prefix to true.

The second part of the patch is to have an alternative implementation under
 the internal option -static-func-strip-dirname-prefix=<value>

This options specifies level of directories to be stripped from the source
filename. Using a large value as the parameter has the same effect as
-static-func-full-module-prefix.

Differential Revision: http://reviews.llvm.org/D29512

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296206 91177308-0d34-0410-b5e6-96231b3b80d8
lib/ProfileData/InstrProf.cpp
test/Transforms/PGOProfile/statics_counter_naming.ll