From d1089e5cea535741b728e4582b0456612f626db9 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Tue, 31 Oct 2017 12:56:09 +0000 Subject: [PATCH] [ThinLTO] Double bits of module hash used for renaming 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 --- llvm/include/llvm/IR/ModuleSummaryIndex.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h index 92dcebe48b01f..2d664f41e3ce5 100644 --- a/llvm/include/llvm/IR/ModuleSummaryIndex.h +++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h @@ -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(); }