diff options
Diffstat (limited to 'llvm/lib/LTO')
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index b2d42f4d2a6..94a4abfb896 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -541,13 +541,15 @@ public: ImportList, DefinedGlobals, ModuleMap); }; - if (!Cache) + auto ModuleID = MBRef.getBufferIdentifier(); + if (!Cache || !CombinedIndex.modulePaths().count(ModuleID)) + // Cache disabled or no entry for this module in the combined index return RunThinBackend(AddStream); SmallString<40> Key; // The module may be cached, this helps handling it. - computeCacheKey(Key, CombinedIndex, MBRef.getBufferIdentifier(), - ImportList, ExportList, ResolvedODR, DefinedGlobals); + computeCacheKey(Key, CombinedIndex, ModuleID, ImportList, ExportList, + ResolvedODR, DefinedGlobals); if (AddStreamFn CacheAddStream = Cache(Task, Key)) return RunThinBackend(CacheAddStream); diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index f4232dc2f89..8afe13d8e16 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -234,6 +234,10 @@ public: if (CachePath.empty()) return; + if (!Index.modulePaths().count(ModuleID)) + // The module does not have an entry, it can't have a hash at all + return; + // Compute the unique hash for this entry // This is based on the current compiler version, the module itself, the // export list, the hash for every single module in the import list, the |