[PATCH] D39443: [ThinLTO] Double bits of module hash used for renaming

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 19:11:03 PDT 2017


tejohnson created this revision.
Herald added a subscriber: inglorion.

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).


https://reviews.llvm.org/D39443

Files:
  include/llvm/IR/ModuleSummaryIndex.h


Index: include/llvm/IR/ModuleSummaryIndex.h
===================================================================
--- include/llvm/IR/ModuleSummaryIndex.h
+++ include/llvm/IR/ModuleSummaryIndex.h
@@ -743,7 +743,8 @@
   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();
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39443.120924.patch
Type: text/x-patch
Size: 571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171031/7dfeafcf/attachment.bin>


More information about the llvm-commits mailing list