[llvm] r250723 - Pass FunctionInfoIndex by reference to WriteFunctionSummaryToFile (NFC)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 12:06:07 PDT 2015


Author: tejohnson
Date: Mon Oct 19 14:06:06 2015
New Revision: 250723

URL: http://llvm.org/viewvc/llvm-project?rev=250723&view=rev
Log:
Pass FunctionInfoIndex by reference to WriteFunctionSummaryToFile (NFC)

Implemented suggestion by dblakie in review for r250704.

Modified:
    llvm/trunk/include/llvm/Bitcode/ReaderWriter.h
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
    llvm/trunk/tools/gold/gold-plugin.cpp
    llvm/trunk/tools/llvm-lto/llvm-lto.cpp

Modified: llvm/trunk/include/llvm/Bitcode/ReaderWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/ReaderWriter.h?rev=250723&r1=250722&r2=250723&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/ReaderWriter.h (original)
+++ llvm/trunk/include/llvm/Bitcode/ReaderWriter.h Mon Oct 19 14:06:06 2015
@@ -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

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=250723&r1=250722&r2=250723&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Oct 19 14:06:06 2015
@@ -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 WriteCombinedValueSymbolTabl
   // FIXME: We know if the type names can use 7-bit ascii.
   SmallVector<unsigned, 64> 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 ValueEn
 
 /// 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 Functi
   unsigned Abbrev6Bit = Stream.EmitAbbrev(Abbv);
 
   SmallVector<unsigned, 64> NameVals;
-  for (const StringMapEntry<uint64_t> &MPSE : I->modPathStringEntries()) {
+  for (const StringMapEntry<uint64_t> &MPSE : I.modPathStringEntries()) {
     StringEncoding Bits =
         getStringEncoding(MPSE.getKey().data(), MPSE.getKey().size());
     unsigned AbbrevToUse = Abbrev8Bit;
@@ -2795,7 +2795,7 @@ static void WritePerModuleFunctionSummar
 
 /// 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
   unsigned FSAbbrev = Stream.EmitAbbrev(Abbv);
 
   SmallVector<unsigned, 64> 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 Modu
 // 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<char, 0> Buffer;
   Buffer.reserve(256 * 1024);

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=250723&r1=250722&r2=250723&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Mon Oct 19 14:06:06 2015
@@ -914,7 +914,7 @@ static ld_plugin_status allSymbolsReadHo
     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();

Modified: llvm/trunk/tools/llvm-lto/llvm-lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-lto/llvm-lto.cpp?rev=250723&r1=250722&r2=250723&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-lto/llvm-lto.cpp (original)
+++ llvm/trunk/tools/llvm-lto/llvm-lto.cpp Mon Oct 19 14:06:06 2015
@@ -208,7 +208,7 @@ static int createCombinedFunctionIndex(S
            << ".thinlto.bc': " << EC.message() << "\n";
     return 1;
   }
-  WriteFunctionSummaryToFile(&CombinedIndex, OS);
+  WriteFunctionSummaryToFile(CombinedIndex, OS);
   OS.close();
   return 0;
 }




More information about the llvm-commits mailing list