From ca21c56a5f5d4754f277d3547bf85446fc1636df Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Mon, 19 Oct 2015 19:06:06 +0000 Subject: [PATCH] Pass FunctionInfoIndex by reference to WriteFunctionSummaryToFile (NFC) Implemented suggestion by dblakie in review for r250704. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250723 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Bitcode/ReaderWriter.h | 2 +- lib/Bitcode/Writer/BitcodeWriter.cpp | 16 ++++++++-------- tools/gold/gold-plugin.cpp | 2 +- tools/llvm-lto/llvm-lto.cpp | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/llvm/Bitcode/ReaderWriter.h b/include/llvm/Bitcode/ReaderWriter.h index 18715844c52..938edf278f7 100644 --- a/include/llvm/Bitcode/ReaderWriter.h +++ b/include/llvm/Bitcode/ReaderWriter.h @@ -101,7 +101,7 @@ namespace llvm { /// Write the specified function summary index to the given raw output stream, /// where it will be written in a new bitcode block. This is used when /// writing the combined index file for ThinLTO. - void WriteFunctionSummaryToFile(const FunctionInfoIndex *Index, + void WriteFunctionSummaryToFile(const FunctionInfoIndex &Index, raw_ostream &Out); /// isBitcodeWrapper - Return true if the given bytes are the magic bytes diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 11f6aea9780..5b50a905e1b 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -2314,7 +2314,7 @@ static void WriteValueSymbolTable( /// Emit function names and summary offsets for the combined index /// used by ThinLTO. -static void WriteCombinedValueSymbolTable(const FunctionInfoIndex *Index, +static void WriteCombinedValueSymbolTable(const FunctionInfoIndex &Index, BitstreamWriter &Stream) { Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4); @@ -2345,7 +2345,7 @@ static void WriteCombinedValueSymbolTable(const FunctionInfoIndex *Index, // FIXME: We know if the type names can use 7-bit ascii. SmallVector NameVals; - for (const auto &FII : *Index) { + for (const auto &FII : Index) { for (const auto &FI : FII.getValue()) { NameVals.push_back(FI->bitcodeIndex()); @@ -2686,7 +2686,7 @@ static void WriteBlockInfo(const ValueEnumerator &VE, BitstreamWriter &Stream) { /// Write the module path strings, currently only used when generating /// a combined index file. -static void WriteModStrings(const FunctionInfoIndex *I, +static void WriteModStrings(const FunctionInfoIndex &I, BitstreamWriter &Stream) { Stream.EnterSubblock(bitc::MODULE_STRTAB_BLOCK_ID, 3); @@ -2717,7 +2717,7 @@ static void WriteModStrings(const FunctionInfoIndex *I, unsigned Abbrev6Bit = Stream.EmitAbbrev(Abbv); SmallVector NameVals; - for (const StringMapEntry &MPSE : I->modPathStringEntries()) { + for (const StringMapEntry &MPSE : I.modPathStringEntries()) { StringEncoding Bits = getStringEncoding(MPSE.getKey().data(), MPSE.getKey().size()); unsigned AbbrevToUse = Abbrev8Bit; @@ -2795,7 +2795,7 @@ static void WritePerModuleFunctionSummary( /// Emit the combined function summary section into the combined index /// file. -static void WriteCombinedFunctionSummary(const FunctionInfoIndex *I, +static void WriteCombinedFunctionSummary(const FunctionInfoIndex &I, BitstreamWriter &Stream) { Stream.EnterSubblock(bitc::FUNCTION_SUMMARY_BLOCK_ID, 3); @@ -2807,12 +2807,12 @@ static void WriteCombinedFunctionSummary(const FunctionInfoIndex *I, unsigned FSAbbrev = Stream.EmitAbbrev(Abbv); SmallVector NameVals; - for (const auto &FII : *I) { + for (const auto &FII : I) { for (auto &FI : FII.getValue()) { FunctionSummary *FS = FI->functionSummary(); assert(FS); - NameVals.push_back(I->getModuleId(FS->modulePath())); + NameVals.push_back(I.getModuleId(FS->modulePath())); NameVals.push_back(FS->instCount()); // Record the starting offset of this summary entry for use @@ -3015,7 +3015,7 @@ void llvm::WriteBitcodeToFile(const Module *M, raw_ostream &Out, // Write the specified function summary index to the given raw output stream, // where it will be written in a new bitcode block. This is used when // writing the combined index file for ThinLTO. -void llvm::WriteFunctionSummaryToFile(const FunctionInfoIndex *Index, +void llvm::WriteFunctionSummaryToFile(const FunctionInfoIndex &Index, raw_ostream &Out) { SmallVector Buffer; Buffer.reserve(256 * 1024); diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index bb718f708cc..062f746c8fc 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -914,7 +914,7 @@ static ld_plugin_status allSymbolsReadHook(raw_fd_ostream *ApiFile) { if (EC) message(LDPL_FATAL, "Unable to open %s.thinlto.bc for writing: %s", output_name.data(), EC.message().c_str()); - WriteFunctionSummaryToFile(&CombinedIndex, OS); + WriteFunctionSummaryToFile(CombinedIndex, OS); OS.close(); cleanup_hook(); diff --git a/tools/llvm-lto/llvm-lto.cpp b/tools/llvm-lto/llvm-lto.cpp index 29d613f8cd2..b35384a0b35 100644 --- a/tools/llvm-lto/llvm-lto.cpp +++ b/tools/llvm-lto/llvm-lto.cpp @@ -208,7 +208,7 @@ static int createCombinedFunctionIndex(StringRef Command) { << ".thinlto.bc': " << EC.message() << "\n"; return 1; } - WriteFunctionSummaryToFile(&CombinedIndex, OS); + WriteFunctionSummaryToFile(CombinedIndex, OS); OS.close(); return 0; } -- 2.34.1