diff --git a/llvm/include/llvm/Bitcode/BitcodeWriter.h b/llvm/include/llvm/Bitcode/BitcodeWriter.h index 770e249290c3c..57551b6937f32 100644 --- a/llvm/include/llvm/Bitcode/BitcodeWriter.h +++ b/llvm/include/llvm/Bitcode/BitcodeWriter.h @@ -102,8 +102,7 @@ class BitcodeWriter { void writeIndex( const ModuleSummaryIndex *Index, - const std::map *ModuleToSummariesForIndex, - const GVSummaryPtrSet *DecSummaries); + const std::map *ModuleToSummariesForIndex); }; /// Write the specified module to the specified raw output stream. @@ -148,12 +147,10 @@ void writeThinLinkBitcodeToFile(const Module &M, raw_ostream &Out, /// where it will be written in a new bitcode block. This is used when /// writing the combined index file for ThinLTO. When writing a subset of the /// index for a distributed backend, provide the \p ModuleToSummariesForIndex -/// map. \p DecSummaries specifies the set of summaries for which the -/// corresponding value should be imported as a declaration (prototype). +/// map. void writeIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out, const std::map - *ModuleToSummariesForIndex = nullptr, - const GVSummaryPtrSet *DecSummaries = nullptr); + *ModuleToSummariesForIndex = nullptr); /// If EmbedBitcode is set, save a copy of the llvm IR as data in the /// __LLVM,__bitcode section (.llvmbc on non-MacOS). diff --git a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h index f1337e82485c9..c450acda82ad0 100644 --- a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h +++ b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h @@ -271,13 +271,12 @@ class ThinLTOCodeGenerator { const lto::InputFile &File); /** - * Compute the list of summaries and the subset of declaration summaries - * needed for importing into module. + * Compute the list of summaries needed for importing into module. */ void gatherImportedSummariesForModule( Module &Module, ModuleSummaryIndex &Index, std::map &ModuleToSummariesForIndex, - GVSummaryPtrSet &DecSummaries, const lto::InputFile &File); + const lto::InputFile &File); /** * Perform internalization. Index is updated to reflect linkage changes. diff --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h b/llvm/include/llvm/Transforms/IPO/FunctionImport.h index 72a0823c6627b..024bba8105b89 100644 --- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h +++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h @@ -212,15 +212,11 @@ bool convertToDeclaration(GlobalValue &GV); /// \p ModuleToSummariesForIndex will be populated with the needed summaries /// from each required module path. Use a std::map instead of StringMap to get /// stable order for bitcode emission. -/// -/// \p DecSummaries will be popluated with the subset of of summary pointers -/// that have 'declaration' import type among all summaries the module need. void gatherImportedSummariesForModule( StringRef ModulePath, const DenseMap &ModuleToDefinedGVSummaries, const FunctionImporter::ImportMapTy &ImportList, - std::map &ModuleToSummariesForIndex, - GVSummaryPtrSet &DecSummaries); + std::map &ModuleToSummariesForIndex); /// Emit into \p OutputFilename the files module \p ModulePath will import from. std::error_code EmitImportsFiles( diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 7d39c0db79fb1..895b58f32fa3d 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -424,11 +424,6 @@ class IndexBitcodeWriter : public BitcodeWriterBase { /// The combined index to write to bitcode. const ModuleSummaryIndex &Index; - /// When writing combined summaries, provides the set of global value - /// summaries for which the value (function, function alias, etc) should be - /// imported as a declaration. - const GVSummaryPtrSet *DecSummaries = nullptr; - /// When writing a subset of the index for distributed backends, client /// provides a map of modules to the corresponding GUIDs/summaries to write. const std::map *ModuleToSummariesForIndex; @@ -453,16 +448,11 @@ class IndexBitcodeWriter : public BitcodeWriterBase { /// Constructs a IndexBitcodeWriter object for the given combined index, /// writing to the provided \p Buffer. When writing a subset of the index /// for a distributed backend, provide a \p ModuleToSummariesForIndex map. - /// If provided, \p ModuleToDecSummaries specifies the set of summaries for - /// which the corresponding functions or aliased functions should be imported - /// as a declaration (but not definition) for each module. IndexBitcodeWriter(BitstreamWriter &Stream, StringTableBuilder &StrtabBuilder, const ModuleSummaryIndex &Index, - const GVSummaryPtrSet *DecSummaries = nullptr, const std::map *ModuleToSummariesForIndex = nullptr) : BitcodeWriterBase(Stream, StrtabBuilder), Index(Index), - DecSummaries(DecSummaries), ModuleToSummariesForIndex(ModuleToSummariesForIndex) { // Assign unique value ids to all summaries to be written, for use // in writing out the call graph edges. Save the mapping from GUID @@ -1208,8 +1198,7 @@ static uint64_t getEncodedFFlags(FunctionSummary::FFlags Flags) { // Decode the flags for GlobalValue in the summary. See getDecodedGVSummaryFlags // in BitcodeReader.cpp. -static uint64_t getEncodedGVSummaryFlags(GlobalValueSummary::GVFlags Flags, - bool ImportAsDecl = false) { +static uint64_t getEncodedGVSummaryFlags(GlobalValueSummary::GVFlags Flags) { uint64_t RawFlags = 0; RawFlags |= Flags.NotEligibleToImport; // bool @@ -1224,8 +1213,7 @@ static uint64_t getEncodedGVSummaryFlags(GlobalValueSummary::GVFlags Flags, RawFlags |= (Flags.Visibility << 8); // 2 bits - unsigned ImportType = Flags.ImportType | ImportAsDecl; - RawFlags |= (ImportType << 10); // 1 bit + RawFlags |= (Flags.ImportType << 10); // 1 bit return RawFlags; } @@ -4563,12 +4551,6 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); unsigned AllocAbbrev = Stream.EmitAbbrev(std::move(Abbv)); - auto shouldImportValueAsDecl = [&](GlobalValueSummary *GVS) -> bool { - if (DecSummaries == nullptr) - return false; - return DecSummaries->contains(GVS); - }; - // The aliases are emitted as a post-pass, and will point to the value // id of the aliasee. Save them in a vector for post-processing. SmallVector Aliases; @@ -4679,8 +4661,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { NameVals.push_back(*ValueId); assert(ModuleIdMap.count(FS->modulePath())); NameVals.push_back(ModuleIdMap[FS->modulePath()]); - NameVals.push_back( - getEncodedGVSummaryFlags(FS->flags(), shouldImportValueAsDecl(FS))); + NameVals.push_back(getEncodedGVSummaryFlags(FS->flags())); NameVals.push_back(FS->instCount()); NameVals.push_back(getEncodedFFlags(FS->fflags())); NameVals.push_back(FS->entryCount()); @@ -4729,8 +4710,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { NameVals.push_back(AliasValueId); assert(ModuleIdMap.count(AS->modulePath())); NameVals.push_back(ModuleIdMap[AS->modulePath()]); - NameVals.push_back( - getEncodedGVSummaryFlags(AS->flags(), shouldImportValueAsDecl(AS))); + NameVals.push_back(getEncodedGVSummaryFlags(AS->flags())); auto AliaseeValueId = SummaryToValueIdMap[&AS->getAliasee()]; assert(AliaseeValueId); NameVals.push_back(AliaseeValueId); @@ -5071,9 +5051,8 @@ void BitcodeWriter::writeModule(const Module &M, void BitcodeWriter::writeIndex( const ModuleSummaryIndex *Index, - const std::map *ModuleToSummariesForIndex, - const GVSummaryPtrSet *DecSummaries) { - IndexBitcodeWriter IndexWriter(*Stream, StrtabBuilder, *Index, DecSummaries, + const std::map *ModuleToSummariesForIndex) { + IndexBitcodeWriter IndexWriter(*Stream, StrtabBuilder, *Index, ModuleToSummariesForIndex); IndexWriter.write(); } @@ -5127,13 +5106,12 @@ void IndexBitcodeWriter::write() { // index for a distributed backend, provide a \p ModuleToSummariesForIndex map. void llvm::writeIndexToFile( const ModuleSummaryIndex &Index, raw_ostream &Out, - const std::map *ModuleToSummariesForIndex, - const GVSummaryPtrSet *DecSummaries) { + const std::map *ModuleToSummariesForIndex) { SmallVector Buffer; Buffer.reserve(256 * 1024); BitcodeWriter Writer(Buffer); - Writer.writeIndex(&Index, ModuleToSummariesForIndex, DecSummaries); + Writer.writeIndex(&Index, ModuleToSummariesForIndex); Writer.writeStrtab(); Out.write((char *)&Buffer.front(), Buffer.size()); diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 7304eab738ce7..e2754d74979e8 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -1400,20 +1400,18 @@ class lto::ThinBackendProc { llvm::StringRef ModulePath, const std::string &NewModulePath) { std::map ModuleToSummariesForIndex; - GVSummaryPtrSet DeclarationSummaries; std::error_code EC; gatherImportedSummariesForModule(ModulePath, ModuleToDefinedGVSummaries, - ImportList, ModuleToSummariesForIndex, - DeclarationSummaries); + ImportList, ModuleToSummariesForIndex); raw_fd_ostream OS(NewModulePath + ".thinlto.bc", EC, sys::fs::OpenFlags::OF_None); if (EC) return errorCodeToError(EC); - writeIndexToFile(CombinedIndex, OS, &ModuleToSummariesForIndex, - &DeclarationSummaries); + // TODO: Serialize declaration bits to bitcode. + writeIndexToFile(CombinedIndex, OS, &ModuleToSummariesForIndex); if (ShouldEmitImportsFiles) { EC = EmitImportsFiles(ModulePath, NewModulePath + ".imports", diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index b054b42b63777..8f517eb50dc76 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -766,7 +766,7 @@ void ThinLTOCodeGenerator::crossModuleImport(Module &TheModule, void ThinLTOCodeGenerator::gatherImportedSummariesForModule( Module &TheModule, ModuleSummaryIndex &Index, std::map &ModuleToSummariesForIndex, - GVSummaryPtrSet &DecSummaries, const lto::InputFile &File) { + const lto::InputFile &File) { auto ModuleCount = Index.modulePaths().size(); auto ModuleIdentifier = TheModule.getModuleIdentifier(); @@ -796,7 +796,7 @@ void ThinLTOCodeGenerator::gatherImportedSummariesForModule( llvm::gatherImportedSummariesForModule( ModuleIdentifier, ModuleToDefinedGVSummaries, - ImportLists[ModuleIdentifier], ModuleToSummariesForIndex, DecSummaries); + ImportLists[ModuleIdentifier], ModuleToSummariesForIndex); } /** @@ -832,14 +832,10 @@ void ThinLTOCodeGenerator::emitImports(Module &TheModule, StringRef OutputName, IsPrevailing(PrevailingCopy), ImportLists, ExportLists); - // 'EmitImportsFiles' emits the list of modules from which to import from, and - // the set of keys in `ModuleToSummariesForIndex` should be a superset of keys - // in `DecSummaries`, so no need to use `DecSummaries` in `EmitImportFiles`. - GVSummaryPtrSet DecSummaries; std::map ModuleToSummariesForIndex; llvm::gatherImportedSummariesForModule( ModuleIdentifier, ModuleToDefinedGVSummaries, - ImportLists[ModuleIdentifier], ModuleToSummariesForIndex, DecSummaries); + ImportLists[ModuleIdentifier], ModuleToSummariesForIndex); std::error_code EC; if ((EC = EmitImportsFiles(ModuleIdentifier, OutputName, diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index cb19bf2a4ae17..a116fd6535347 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -1435,8 +1435,7 @@ void llvm::gatherImportedSummariesForModule( StringRef ModulePath, const DenseMap &ModuleToDefinedGVSummaries, const FunctionImporter::ImportMapTy &ImportList, - std::map &ModuleToSummariesForIndex, - GVSummaryPtrSet &DecSummaries) { + std::map &ModuleToSummariesForIndex) { // Include all summaries from the importing module. ModuleToSummariesForIndex[std::string(ModulePath)] = ModuleToDefinedGVSummaries.lookup(ModulePath); @@ -1451,7 +1450,7 @@ void llvm::gatherImportedSummariesForModule( assert(DS != DefinedGVSummaries.end() && "Expected a defined summary for imported global value"); if (Type == GlobalValueSummary::Declaration) - DecSummaries.insert(DS->second); + continue; SummariesForIndex[GUID] = DS->second; } diff --git a/llvm/test/ThinLTO/X86/import_callee_declaration.ll b/llvm/test/ThinLTO/X86/import_callee_declaration.ll index 246920e5db0dc..43214e3cf9412 100644 --- a/llvm/test/ThinLTO/X86/import_callee_declaration.ll +++ b/llvm/test/ThinLTO/X86/import_callee_declaration.ll @@ -15,20 +15,16 @@ ; and the other one is larger. Both callees of 'small_func' are defined in lib.ll. ; - Given the import limit, in main's combined summary, the import type of 'small_func' ; and 'small_indirect_callee' will be 'definition', and the import type of -; large* functions and their aliasees will be 'declaration'. +; 'large_func' and 'large_indirect_callee' will be 'declaration'. ; ; The test will disassemble combined summaries and check the import type is ; correct. Right now postlink optimizer pipeline doesn't do anything (e.g., ; import the declaration or de-serialize summary attributes yet) so there is ; nothing to test more than the summary content. ; -; TODO: Extend this test case to test IR once postlink optimizer makes use of -; the import type for declarations. -; ; RUN: llvm-lto2 run \ ; RUN: -debug-only=function-import \ ; RUN: -import-instr-limit=7 \ -; RUN: -import-instr-evolution-factor=1.0 \ ; RUN: -import-declaration \ ; RUN: -thinlto-distributed-indexes \ ; RUN: -r=main.bc,main,px \ @@ -36,45 +32,36 @@ ; RUN: -r=main.bc,large_func, \ ; RUN: -r=lib.bc,callee,pl \ ; RUN: -r=lib.bc,large_indirect_callee,px \ -; RUN: -r=lib.bc,large_indirect_bar,px \ ; RUN: -r=lib.bc,small_func,px \ ; RUN: -r=lib.bc,large_func,px \ ; RUN: -r=lib.bc,large_indirect_callee_alias,px \ -; RUN: -r=lib.bc,large_indirect_bar_alias,px \ -; RUN: -r=lib.bc,calleeAddrs,px -r=lib.bc,calleeAddrs2,px -o summary main.bc lib.bc 2>&1 | FileCheck %s --check-prefix=DUMP +; RUN: -r=lib.bc,calleeAddrs,px -o summary main.bc lib.bc 2>&1 | FileCheck %s --check-prefix=DUMP ; -; RUN: llvm-lto -thinlto-action=thinlink -import-declaration -import-instr-limit=7 -import-instr-evolution-factor=1.0 -o combined.index.bc main.bc lib.bc -; RUN: llvm-lto -thinlto-action=distributedindexes -debug-only=function-import -import-declaration -import-instr-limit=7 -import-instr-evolution-factor=1.0 -thinlto-index combined.index.bc main.bc lib.bc 2>&1 | FileCheck %s --check-prefix=DUMP +; RUN: llvm-lto -thinlto-action=thinlink -import-declaration -import-instr-limit=7 -o combined.index.bc main.bc lib.bc +; RUN: llvm-lto -thinlto-action=distributedindexes -debug-only=function-import -import-declaration -import-instr-limit=7 -thinlto-index combined.index.bc main.bc lib.bc 2>&1 | FileCheck %s --check-prefix=DUMP -; DUMP: - 2 function definitions and 4 function declarations imported from lib.bc +; DUMP: - 2 function definitions and 3 function declarations imported from lib.bc ; First disassemble per-module summary and find out the GUID for {large_func, large_indirect_callee}. ; ; RUN: llvm-dis lib.bc -o - | FileCheck %s --check-prefix=LIB-DIS -; LIB-DIS: module: (path: "lib.bc", hash: (0, 0, 0, 0, 0)) -; LIB-DIS: gv: (name: "large_func", summaries: {{.*}}) ; guid = 2418497564662708935 -; LIB-DIS: gv: (name: "large_indirect_bar_alias", summaries: {{.*}}, aliasee: [[LARGEINDIRECT_BAR:\^[0-9]+]]{{.*}}guid = 13590951773474913315 -; LIB-DIS: [[LARGEINDIRECT_BAR]] = gv: (name: "large_indirect_bar", summaries: {{.*}}) ; guid = 13770917885399536773 +; LIB-DIS: [[LARGEFUNC:\^[0-9]+]] = gv: (name: "large_func", summaries: {{.*}}) ; guid = 2418497564662708935 ; LIB-DIS: [[LARGEINDIRECT:\^[0-9]+]] = gv: (name: "large_indirect_callee", summaries: {{.*}}) ; guid = 14343440786664691134 -; LIB-DIS: gv: (name: "large_indirect_callee_alias", summaries: {{.*}}, aliasee: [[LARGEINDIRECT]]{{.*}}guid = 16730173943625350469 +; LIB-DIS: [[LARGEINDIRECTALIAS:\^[0-9]+]] = gv: (name: "large_indirect_callee_alias", summaries: {{.*}}, aliasee: [[LARGEINDIRECT]] ; -; Secondly disassemble main's combined summary and verify the import type of -; these two GUIDs are declaration. +; Secondly disassemble main's combined summary and test that large callees are +; not imported as declarations yet. ; ; RUN: llvm-dis main.bc.thinlto.bc -o - | FileCheck %s --check-prefix=MAIN-DIS ; ; MAIN-DIS: [[LIBMOD:\^[0-9]+]] = module: (path: "lib.bc", hash: (0, 0, 0, 0, 0)) -; MAIN-DIS: gv: (guid: 2418497564662708935, summaries: (function: (module: [[LIBMOD]], flags: ({{.*}} importType: declaration), insts: 8, {{.*}}))) -; When alias is imported as a copy of the aliasee, but the aliasee is not being -; imported by itself, the aliasee should be null. -; MAIN-DIS: gv: (guid: 13590951773474913315, summaries: (alias: (module: [[LIBMOD]], flags: ({{.*}} importType: declaration), aliasee: null))) -; MAIN-DIS: [[LARGEINDIRECT:\^[0-9]+]] = gv: (guid: 14343440786664691134, summaries: (function: (module: [[LIBMOD]], flags: ({{.*}} importType: declaration), insts: 8, {{.*}}))) -; MAIN-DIS: gv: (guid: 16730173943625350469, summaries: (alias: (module: [[LIBMOD]], flags: ({{.*}} importType: declaration), aliasee: [[LARGEINDIRECT]]))) +; MAIN-DIS-NOT: [[LARGEFUNC:\^[0-9]+]] = gv: (guid: 2418497564662708935, summaries: (function: (module: [[LIBMOD]], flags: ({{.*}} importType: declaration), insts: 8, {{.*}}))) +; MAIN-DIS-NOT: [[LARGEINDIRECT:\^[0-9]+]] = gv: (guid: 14343440786664691134, summaries: (function: (module: [[LIBMOD]], flags: ({{.*}} importType: declaration), insts: 8, {{.*}}))) +; MAIN-DIS-NOT: [[LARGEINDIRECTALIAS:\^[0-9]+]] = gv: (guid: 16730173943625350469, summaries: (alias: (module: [[LIBMOD]], flags: ({{.*}} importType: declaration) ; Run in-process ThinLTO and tests that ; 1. `callee` remains internalized even if the symbols of its callers -; (large_func, large_indirect_callee, large_indirect_bar) are exported as -; declarations and visible to main module. +; (large_func and large_indirect_callee) are exported as declarations and visible to main module. ; 2. the debugging logs from `function-import` pass are expected. ; RUN: llvm-lto2 run \ @@ -82,21 +69,20 @@ ; RUN: -save-temps \ ; RUN: -thinlto-threads=1 \ ; RUN: -import-instr-limit=7 \ -; RUN: -import-instr-evolution-factor=1.0 \ ; RUN: -import-declaration \ ; RUN: -r=main.bc,main,px \ ; RUN: -r=main.bc,small_func, \ ; RUN: -r=main.bc,large_func, \ ; RUN: -r=lib.bc,callee,pl \ ; RUN: -r=lib.bc,large_indirect_callee,px \ -; RUN: -r=lib.bc,large_indirect_bar,px \ ; RUN: -r=lib.bc,small_func,px \ ; RUN: -r=lib.bc,large_func,px \ ; RUN: -r=lib.bc,large_indirect_callee_alias,px \ -; RUN: -r=lib.bc,large_indirect_bar_alias,px \ -; RUN: -r=lib.bc,calleeAddrs,px -r=lib.bc,calleeAddrs2,px -o in-process main.bc lib.bc 2>&1 | FileCheck %s --check-prefix=IMPORTDUMP +; RUN: -r=lib.bc,calleeAddrs,px -o in-process main.bc lib.bc 2>&1 | FileCheck %s --check-prefix=IMPORTDUMP -; TODO: Extend this test case to test IR once postlink optimizer makes use of +; Test import status from debugging logs. +; TODO: Serialize declaration bit and test declaration bits are correctly set, +; and extend this test case to test IR once postlink optimizer makes use of ; the import type for declarations. ; IMPORTDUMP-DAG: Not importing function 11825436545918268459 callee from lib.cc ; IMPORTDUMP-DAG: Is importing function declaration 14343440786664691134 large_indirect_callee from lib.cc @@ -105,8 +91,6 @@ ; IMPORTDUMP-DAG: Is importing function declaration 2418497564662708935 large_func from lib.cc ; IMPORTDUMP-DAG: Not importing global 7680325410415171624 calleeAddrs from lib.cc ; IMPORTDUMP-DAG: Is importing alias declaration 16730173943625350469 large_indirect_callee_alias from lib.cc -; IMPORTDUMP-DAG: Is importing alias declaration 13590951773474913315 large_indirect_bar_alias from lib.cc -; IMPORTDUMP-DAG: Not importing function 13770917885399536773 large_indirect_bar ; RUN: llvm-dis in-process.1.3.import.bc -o - | FileCheck %s --check-prefix=IMPORT @@ -117,8 +101,6 @@ ; IMPORT-DAG: declare void @large_func ; IMPORT-NOT: large_indirect_callee ; IMPORT-NOT: large_indirect_callee_alias -; IMPORT-NOT: large_indirect_bar -; IMPORT-NOT: large_indirect_bar_alias ; INTERNALIZE: define internal void @callee() @@ -142,13 +124,8 @@ source_filename = "lib.cc" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -; Both large_indirect_callee and large_indirect_callee_alias are referenced -; and visible to main.ll. @calleeAddrs = global [3 x ptr] [ptr @large_indirect_callee, ptr @small_indirect_callee, ptr @large_indirect_callee_alias] -; large_indirect_bar_alias is visible to main.ll but its aliasee isn't. -@calleeAddrs2 = global [1 x ptr] [ptr @large_indirect_bar_alias] - define void @callee() #1 { ret void } @@ -164,28 +141,12 @@ define void @large_indirect_callee()#2 { ret void } -define void @large_indirect_bar()#2 { - call void @callee() - call void @callee() - call void @callee() - call void @callee() - call void @callee() - call void @callee() - call void @callee() - ret void -} - define internal void @small_indirect_callee() #0 { -entry: - %0 = load ptr, ptr @calleeAddrs2 - call void %0(), !prof !3 ret void } @large_indirect_callee_alias = alias void(), ptr @large_indirect_callee -@large_indirect_bar_alias = alias void(), ptr @large_indirect_bar - define void @small_func() { entry: %0 = load ptr, ptr @calleeAddrs @@ -218,4 +179,3 @@ attributes #2 = { norecurse } !0 = !{!"VP", i32 0, i64 1, i64 14343440786664691134, i64 1} !1 = !{!"VP", i32 0, i64 1, i64 13568239288960714650, i64 1} !2 = !{!"VP", i32 0, i64 1, i64 16730173943625350469, i64 1} -!3 = !{!"VP", i32 0, i64 1, i64 13590951773474913315, i64 1} diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp index 8218bd5a74ea3..f310097eec634 100644 --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -692,9 +692,8 @@ class ThinLTOProcessing { // Build a map of module to the GUIDs and summary objects that should // be written to its index. std::map ModuleToSummariesForIndex; - GVSummaryPtrSet DecSummaries; ThinGenerator.gatherImportedSummariesForModule( - *TheModule, *Index, ModuleToSummariesForIndex, DecSummaries, *Input); + *TheModule, *Index, ModuleToSummariesForIndex, *Input); std::string OutputName = OutputFilename; if (OutputName.empty()) { @@ -704,7 +703,7 @@ class ThinLTOProcessing { std::error_code EC; raw_fd_ostream OS(OutputName, EC, sys::fs::OpenFlags::OF_None); error(EC, "error opening the file '" + OutputName + "'"); - writeIndexToFile(*Index, OS, &ModuleToSummariesForIndex, &DecSummaries); + writeIndexToFile(*Index, OS, &ModuleToSummariesForIndex); } }