Skip to content

Commit

Permalink
Revert "[IndirectCallPromotion] Don't strip ".__uniq." suffix when it…
Browse files Browse the repository at this point in the history
… strips"

This reverts commit 90dfbee.
Causes PR49554. Also see comments on https://reviews.llvm.org/D98389
  • Loading branch information
nico committed Mar 12, 2021
1 parent a2eca31 commit 08a5277
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 118 deletions.
33 changes: 10 additions & 23 deletions llvm/lib/ProfileData/InstrProf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,29 +353,16 @@ Error InstrProfSymtab::create(Module &M, bool InLTO) {
return E;
MD5FuncMap.emplace_back(Function::getGUID(PGOFuncName), &F);
// In ThinLTO, local function may have been promoted to global and have
// suffix ".llvm." 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.
//
// We may have other suffixes similar as ".llvm." which are needed to
// be stripped before the matching, but ".__uniq." suffix which is used
// to differentiate internal linkage functions in different modules
// should be kept. Now this is the only suffix with the pattern ".xxx"
// which is kept before matching.
const std::string UniqSuffix = ".__uniq.";
auto pos = PGOFuncName.find(UniqSuffix);
// Search '.' after ".__uniq." if ".__uniq." exists, otherwise
// search '.' from the beginning.
if (pos != std::string::npos)
pos += UniqSuffix.length();
else
pos = 0;
pos = PGOFuncName.find('.', pos);
if (pos != std::string::npos) {
const std::string &OtherFuncName = PGOFuncName.substr(0, pos);
if (Error E = addFuncName(OtherFuncName))
return E;
MD5FuncMap.emplace_back(Function::getGUID(OtherFuncName), &F);
// 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);
if (Error E = addFuncName(OtherFuncName))
return E;
MD5FuncMap.emplace_back(Function::getGUID(OtherFuncName), &F);
}
}
}
Sorted = false;
Expand Down
95 changes: 0 additions & 95 deletions llvm/test/Transforms/PGOProfile/indirect_call_promotion_unique.ll

This file was deleted.

0 comments on commit 08a5277

Please sign in to comment.