From 8010f4037a3f8a875d121224f2e02914e941c257 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 31 Dec 2019 14:14:31 +0100 Subject: [PATCH] Update thinLTOInternalizeAndPromoteInIndex() usage --- src/rustllvm/PassWrapper.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 162193c0db7..eaa845a279f 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -962,6 +962,15 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, ExportedGUIDs.insert(GUID); } } +#if LLVM_VERSION_GE(10, 0) + auto isExported = [&](StringRef ModuleIdentifier, ValueInfo VI) { + const auto &ExportList = Ret->ExportLists.find(ModuleIdentifier); + return (ExportList != Ret->ExportLists.end() && + ExportList->second.count(VI)) || + ExportedGUIDs.count(VI.getGUID()); + }; + thinLTOInternalizeAndPromoteInIndex(Ret->Index, isExported, isPrevailing); +#else auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) { const auto &ExportList = Ret->ExportLists.find(ModuleIdentifier); return (ExportList != Ret->ExportLists.end() && @@ -969,6 +978,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, ExportedGUIDs.count(GUID); }; thinLTOInternalizeAndPromoteInIndex(Ret->Index, isExported); +#endif return Ret.release(); }