llvm.org GIT mirror llvm / 3982fbc
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348216 91177308-0d34-0410-b5e6-96231b3b80d8 George Burgess IV 9 months ago
2 changed file(s) with 16 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
220220 // Imported functions may introduce new uses of type identifier resolutions,
221221 // so we need to collect their used resolutions as well.
222222 for (auto &ImpM : ImportList)
223 for (auto &ImpF : ImpM.second)
224 AddUsedThings(Index.findSummaryInModule(ImpF, ImpM.first()));
223 for (auto &ImpF : ImpM.second) {
224 GlobalValueSummary *S = Index.findSummaryInModule(ImpF, ImpM.first());
225 AddUsedThings(S);
226 // If this is an alias, we also care about any types/etc. that the aliasee
227 // may reference.
228 if (auto *AS = dyn_cast_or_null(S))
229 AddUsedThings(AS->getBaseObject());
230 }
225231
226232 auto AddTypeIdSummary = [&](StringRef TId, const TypeIdSummary &S) {
227233 AddString(TId);
88 ; where both t and t-import are sensitive to typeid1's resolution
99 ; so 4 distinct objects in total.
1010 ; RUN: rm -rf %t.cache
11 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
12 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t1.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx -r=%t1.bc,vt1,plx
11 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f1_actual,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
12 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t1.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f1_actual,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx -r=%t1.bc,vt1,plx
1313 ; RUN: ls %t.cache | count 4
1414
1515 ; Three resolutions for typeid2: Indir, SingleImpl, UniqueRetVal
1616 ; where both t and t-import are sensitive to typeid2's resolution
1717 ; so 6 distinct objects in total.
1818 ; RUN: rm -rf %t.cache
19 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
20 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t2.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t2.bc,vt2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
21 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t3.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t3.bc,vt2a,plx -r=%t3.bc,vt2b,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
19 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t.bc,f1_actual,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
20 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t2.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t.bc,f1_actual,plx -r=%t2.bc,vt2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
21 ; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t3.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t.bc,f1_actual,plx -r=%t3.bc,vt2a,plx -r=%t3.bc,vt2b,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx
2222 ; RUN: ls %t.cache | count 6
2323
2424 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
2525 target triple = "x86_64-unknown-linux-gnu"
2626
27 define i1 @f1(i8* %p) {
27 @f1 = alias i1(i8*), i1 (i8*)* @f1_actual
28
29 define i1 @f1_actual(i8* %p) {
2830 %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1")
2931 ret i1 %x
3032 }