[IndirectCallPromotion] Recommit "Don't strip ".__uniq." suffix when it strips
authorWei Mi <wmi@google.com>
Fri, 12 Mar 2021 19:34:56 +0000 (11:34 -0800)
committerWei Mi <wmi@google.com>
Fri, 12 Mar 2021 21:48:14 +0000 (13:48 -0800)
commitef9d7db72362b2df1237a87d5dc7dad6b0105df6
tree9c316a5aa05293d4ea34543795465a5182051538
parente9e788d145f57bcf815b9797191c1560ba39b842
[IndirectCallPromotion] Recommit "Don't strip ".__uniq." suffix when it strips
".llvm." suffix".

The recommit fixed a bug that symbols with "." at the beginning is not
properly handled in the last commit.

Original commit message:
Currently IndirectCallPromotion simply strip everything after the first "."
in LTO mode, in order to match the symbol name and the name with ".llvm."
suffix in the value profile. However, if -funique-internal-linkage-names
and thinlto are both enabled, the name may have both ".__uniq." suffix and
".llvm." suffix, and the current mechanism will strip them both, which is
unexpected. The patch fixes the problem.

Differential Revision: https://reviews.llvm.org/D98389
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
llvm/test/Transforms/PGOProfile/indirect_call_promotion_unique.ll [new file with mode: 0644]