diff options
| author | bors <bors@rust-lang.org> | 2017-10-15 20:07:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-10-15 20:07:35 +0000 |
| commit | 29ed49fb0aeab444adcfe16ef3d04e5e910fb08d (patch) | |
| tree | 612a8d9d8aab8b4498c7e57d179f63e499f18663 /src/rustllvm/PassWrapper.cpp | |
| parent | c4f489af912bea9ca9f0fa0378d7c0acacf6c59e (diff) | |
| parent | 2e1c4cd0f51c28b8cfc003fda67f6641bb4335f2 (diff) | |
| download | rust-29ed49fb0aeab444adcfe16ef3d04e5e910fb08d.tar.gz rust-29ed49fb0aeab444adcfe16ef3d04e5e910fb08d.zip | |
Auto merge of #45215 - alexcrichton:thin-lto-reference-more, r=michaelwoerister
rustc: Fix some ThinLTO internalization First the `addPreservedGUID` function forgot to take care of "alias" summaries. I'm not 100% sure what this is but the current code now matches upstream. Next the `computeDeadSymbols` return value wasn't actually being used, but it needed to be used! Together these should... Closes #45195
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
| -rw-r--r-- | src/rustllvm/PassWrapper.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index e37f048dd47..1287b94159a 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -901,9 +901,7 @@ addPreservedGUID(const ModuleSummaryIndex &Index, } } - GlobalValueSummary *GVSummary = Summary.get(); - if (isa<FunctionSummary>(GVSummary)) { - FunctionSummary *FS = cast<FunctionSummary>(GVSummary); + if (auto *FS = dyn_cast<FunctionSummary>(Summary.get())) { for (auto &Call: FS->calls()) { if (Call.first.isGUID()) { addPreservedGUID(Index, Preserved, Call.first.getGUID()); @@ -916,6 +914,10 @@ addPreservedGUID(const ModuleSummaryIndex &Index, addPreservedGUID(Index, Preserved, GUID); } } + if (auto *AS = dyn_cast<AliasSummary>(Summary.get())) { + auto GUID = AS->getAliasee().getOriginalName(); + addPreservedGUID(Index, Preserved, GUID); + } } } @@ -963,12 +965,13 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, // combined index // // This is copied from `lib/LTO/ThinLTOCodeGenerator.cpp` - computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols); + auto DeadSymbols = computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols); ComputeCrossModuleImport( Ret->Index, Ret->ModuleToDefinedGVSummaries, Ret->ImportLists, - Ret->ExportLists + Ret->ExportLists, + &DeadSymbols ); // Resolve LinkOnce/Weak symbols, this has to be computed early be cause it |
