Skip to content

Commit

Permalink
[ThinLTO] Double bits of module hash used for renaming
Browse files Browse the repository at this point in the history
Summary:
Use 64 instead of 32 bits of the module hash as the suffix when renaming
after promotion to reduce the likelihood of a collision (which we
observed in a binary when using 32 bits).

Reviewers: pcc

Subscribers: llvm-commits, inglorion

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

llvm-svn: 316996
  • Loading branch information
teresajohnson committed Oct 31, 2017
1 parent ff426d9 commit d1089e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/include/llvm/IR/ModuleSummaryIndex.h
Expand Up @@ -743,7 +743,8 @@ class ModuleSummaryIndex {
static std::string getGlobalNameForLocal(StringRef Name, ModuleHash ModHash) {
SmallString<256> NewName(Name);
NewName += ".llvm.";
NewName += utostr(ModHash[0]); // Take the first 32 bits
NewName += utostr((uint64_t(ModHash[0]) << 32) |
ModHash[1]); // Take the first 64 bits
return NewName.str();
}

Expand Down

0 comments on commit d1089e5

Please sign in to comment.