@@ -902,14 +902,19 @@ addPreservedGUID(const ModuleSummaryIndex &Index,
902
902
903
903
GlobalValueSummary *GVSummary = Summary.get ();
904
904
if (isa<FunctionSummary>(GVSummary)) {
905
- FunctionSummary *FS = cast<FunctionSummary>(GVSummary);
905
+ auto *FS = cast<FunctionSummary>(GVSummary);
906
906
for (auto &Call: FS->calls ()) {
907
907
addPreservedGUID (Index, Preserved, Call.first .getGUID ());
908
908
}
909
909
for (auto &GUID: FS->type_tests ()) {
910
910
addPreservedGUID (Index, Preserved, GUID);
911
911
}
912
912
}
913
+ if (isa<AliasSummary>(GVSummary)) {
914
+ auto *AS = cast<AliasSummary>(GVSummary);
915
+ auto GUID = AS->getAliasee ().getOriginalName ();
916
+ addPreservedGUID (Index, Preserved, GUID);
917
+ }
913
918
}
914
919
#else
915
920
auto SummaryList = Index.findGlobalValueSummaryList (GUID);
@@ -997,6 +1002,15 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
997
1002
// combined index
998
1003
//
999
1004
// This is copied from `lib/LTO/ThinLTOCodeGenerator.cpp`
1005
+ #if LLVM_VERSION_GE(5, 0)
1006
+ computeDeadSymbols (Ret->Index , Ret->GUIDPreservedSymbols );
1007
+ ComputeCrossModuleImport (
1008
+ Ret->Index ,
1009
+ Ret->ModuleToDefinedGVSummaries ,
1010
+ Ret->ImportLists ,
1011
+ Ret->ExportLists
1012
+ );
1013
+ #else
1000
1014
auto DeadSymbols = computeDeadSymbols (Ret->Index , Ret->GUIDPreservedSymbols );
1001
1015
ComputeCrossModuleImport (
1002
1016
Ret->Index ,
@@ -1005,6 +1019,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
1005
1019
Ret->ExportLists ,
1006
1020
&DeadSymbols
1007
1021
);
1022
+ #endif
1008
1023
1009
1024
// Resolve LinkOnce/Weak symbols, this has to be computed early be cause it
1010
1025
// impacts the caching.
0 commit comments