aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2018-12-04 00:02:33 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2018-12-04 00:02:33 +0000
commitcf5ecb1adb67b6884d332255b31b7dd303457691 (patch)
tree57c36e4220c8cd58d96bd7e89e6e694980c4a4c6 /llvm/lib/LTO/LTO.cpp
parentf5d1b6413f4f9a160e030b1a467be0aee7dbfafc (diff)
downloadllvm-cf5ecb1adb67b6884d332255b31b7dd303457691.zip
llvm-cf5ecb1adb67b6884d332255b31b7dd303457691.tar.gz
llvm-cf5ecb1adb67b6884d332255b31b7dd303457691.tar.bz2
[ThinLTO] Look through aliases when computing hash keys
Without this, we don't consider types used by aliasees in our cache key. This caused issues when using the same cache for thin-linking the same TU with different sets of virtual call candidates for a virtual call inside of a constructor. That's sort of a mouthful. :) Differential Revision: https://reviews.llvm.org/D55060 llvm-svn: 348216
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index f4840db..c1d3cad 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -221,8 +221,14 @@ void llvm::computeLTOCacheKey(
// Imported functions may introduce new uses of type identifier resolutions,
// so we need to collect their used resolutions as well.
for (auto &ImpM : ImportList)
- for (auto &ImpF : ImpM.second)
- AddUsedThings(Index.findSummaryInModule(ImpF, ImpM.first()));
+ for (auto &ImpF : ImpM.second) {
+ GlobalValueSummary *S = Index.findSummaryInModule(ImpF, ImpM.first());
+ AddUsedThings(S);
+ // If this is an alias, we also care about any types/etc. that the aliasee
+ // may reference.
+ if (auto *AS = dyn_cast_or_null<AliasSummary>(S))
+ AddUsedThings(AS->getBaseObject());
+ }
auto AddTypeIdSummary = [&](StringRef TId, const TypeIdSummary &S) {
AddString(TId);