]> granicus.if.org Git - llvm/commit
[PGO] Turn off comdat renaming in IR PGO by default
authorRong Xu <xur@google.com>
Tue, 10 Jan 2017 19:30:20 +0000 (19:30 +0000)
committerRong Xu <xur@google.com>
Tue, 10 Jan 2017 19:30:20 +0000 (19:30 +0000)
commit2cf892fefa486af61f51f2ed7800e6314c2ffd0b
tree70d39ce72ca3452edd02b7ab3f3d4c3d273d1608
parentef64b17169828d6faadbbaae510330b9e1703772
[PGO] Turn off comdat renaming in IR PGO by default

Summary:
In IR PGO we append the function hash to comdat functions to avoid the
potential hash mismatch. This turns out not legal in some cases: if the comdat
function is address-taken and used in comparison. Renaming changes the semantic.

This patch turns off comdat renaming by default.

To alleviate the hash mismatch issue, we now rename the profile variable
for comdat functions. Profile allows co-existing multiple versions of profiles
with different hash value. The inlined copy will always has the correct profile
counter. The out-of-line copy might not have the correct count. But we will
not have the bogus mismatch warning.

Reviewers: davidxl

Subscribers: llvm-commits, xur

Differential Revision: https://reviews.llvm.org/D28416

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291588 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ProfileData/InstrProf.h
lib/ProfileData/InstrProf.cpp
lib/Transforms/Instrumentation/InstrProfiling.cpp
lib/Transforms/Instrumentation/PGOInstrumentation.cpp
test/Transforms/PGOProfile/Inputs/multiple_hash_profile.proftext [new file with mode: 0644]
test/Transforms/PGOProfile/comdat_internal.ll
test/Transforms/PGOProfile/comdat_rename.ll
test/Transforms/PGOProfile/indirect_call_profile.ll
test/Transforms/PGOProfile/multiple_hash_profile.ll [new file with mode: 0644]