Add a module Hash in the bitcode and the combined index, implementing a kind of "build-id"
This is intended to be used for ThinLTO incremental build.
Differential Revision: http://reviews.llvm.org/D18213
This is a recommit of r265095 after fixing the Windows issues.
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 265111
diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp
index 16b58dd..c23e072 100644
--- a/llvm/lib/IR/ModuleSummaryIndex.cpp
+++ b/llvm/lib/IR/ModuleSummaryIndex.cpp
@@ -37,9 +37,11 @@
// Add the module path string ref for this module if we haven't already
// saved a reference to it.
- if (ModPath.empty())
- ModPath = addModulePath(Info->summary()->modulePath(), NextModuleId);
- else
+ if (ModPath.empty()) {
+ auto Path = Info->summary()->modulePath();
+ ModPath = addModulePath(Path, NextModuleId, Other->getModuleHash(Path))
+ ->first();
+ } else
assert(ModPath == Info->summary()->modulePath() &&
"Each module in the combined map should have a unique ID");