summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitf82bda0a7ac91c18051f346b719c7cf6faadbc00 (patch)
tree6520f8f922f1812669349d4042f04035206af71d /llvm/lib/LTO/LTO.cpp
parent00fa1409ec8d8d6db8597fbe73eac65094e8b425 (diff)
downloadbcm5719-llvm-f82bda0a7ac91c18051f346b719c7cf6faadbc00.tar.gz
bcm5719-llvm-f82bda0a7ac91c18051f346b719c7cf6faadbc00.zip
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 llvm-svn: 283655
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 94a4abfb896..8d23f53eae6 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud