summaryrefslogtreecommitdiff
path: root/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-10-08 04:44:23 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-10-08 04:44:23 +0000
commitccef33b45b61ff5586394997ebdde1001230a36d (patch)
treecc67367c90a190d29b4724f638b431854261df7d /lib/LTO/LTO.cpp
parent7fe28f81dbac2aac6789f1519d41d739636809c2 (diff)
ThinLTO: don't perform incremental LTO on module without a hash
Clang always emit a hash for ThinLTO, but as other frontend are starting to use ThinLTO, this could be a serious bug. Differential Revision: https://reviews.llvm.org/D25379 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283655 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/LTO/LTO.cpp')
-rw-r--r--lib/LTO/LTO.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/LTO/LTO.cpp b/lib/LTO/LTO.cpp
index 94a4abfb896..8d23f53eae6 100644
--- a/lib/LTO/LTO.cpp
+++ b/lib/LTO/LTO.cpp
@@ -542,8 +542,12 @@ public:
};
auto ModuleID = MBRef.getBufferIdentifier();
- if (!Cache || !CombinedIndex.modulePaths().count(ModuleID))
- // Cache disabled or no entry for this module in the combined index
+
+ if (!Cache || !CombinedIndex.modulePaths().count(ModuleID) ||
+ all_of(CombinedIndex.getModuleHash(ModuleID),
+ [](uint32_t V) { return V == 0; }))
+ // Cache disabled or no entry for this module in the combined index or
+ // no module hash.
return RunThinBackend(AddStream);
SmallString<40> Key;