summaryrefslogtreecommitdiff
path: root/lib/ProfileData
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ProfileData')
-rw-r--r--lib/ProfileData/InstrProf.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ProfileData/InstrProf.cpp b/lib/ProfileData/InstrProf.cpp
index ccaf15b9840..bbefde709cf 100644
--- a/lib/ProfileData/InstrProf.cpp
+++ b/lib/ProfileData/InstrProf.cpp
@@ -298,6 +298,17 @@ void InstrProfSymtab::create(Module &M, bool InLTO) {
const std::string &PGOFuncName = getPGOFuncName(F, InLTO);
addFuncName(PGOFuncName);
MD5FuncMap.emplace_back(Function::getGUID(PGOFuncName), &F);
+ // In ThinLTO, local function may have been promoted to global and have
+ // suffix added to the function name. We need to add the stripped function
+ // name to the symbol table so that we can find a match from profile.
+ if (InLTO) {
+ auto pos = PGOFuncName.find('.');
+ if (pos != std::string::npos) {
+ const std::string &OtherFuncName = PGOFuncName.substr(0, pos);
+ addFuncName(OtherFuncName);
+ MD5FuncMap.emplace_back(Function::getGUID(OtherFuncName), &F);
+ }
+ }
}
finalizeSymtab();