Revert "[ThinLTO] Renaming of function index to module summary index (NFC)"

This reverts commit r263490. Missed a file.

llvm-svn: 263493
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 369e2fb..fb283ad 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -31,7 +31,7 @@
 #include "llvm/IR/Verifier.h"
 #include "llvm/Linker/IRMover.h"
 #include "llvm/MC/SubtargetFeature.h"
-#include "llvm/Object/ModuleSummaryIndexObjectFile.h"
+#include "llvm/Object/FunctionIndexObjectFile.h"
 #include "llvm/Object/IRObjectFile.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/ManagedStatic.h"
@@ -624,8 +624,8 @@
   return View;
 }
 
-static std::unique_ptr<ModuleSummaryIndex>
-getModuleSummaryIndexForFile(claimed_file &F, ld_plugin_input_file &Info) {
+static std::unique_ptr<FunctionInfoIndex>
+getFunctionIndexForFile(claimed_file &F, ld_plugin_input_file &Info) {
   const void *View = getSymbolsAndView(F);
   if (!View)
     return nullptr;
@@ -635,20 +635,18 @@
 
   // Don't bother trying to build an index if there is no summary information
   // in this bitcode file.
-  if (!object::ModuleSummaryIndexObjectFile::hasGlobalValueSummaryInMemBuffer(
+  if (!object::FunctionIndexObjectFile::hasGlobalValueSummaryInMemBuffer(
           BufferRef, diagnosticHandler))
-    return std::unique_ptr<ModuleSummaryIndex>(nullptr);
+    return std::unique_ptr<FunctionInfoIndex>(nullptr);
 
-  ErrorOr<std::unique_ptr<object::ModuleSummaryIndexObjectFile>> ObjOrErr =
-      object::ModuleSummaryIndexObjectFile::create(BufferRef,
-                                                   diagnosticHandler);
+  ErrorOr<std::unique_ptr<object::FunctionIndexObjectFile>> ObjOrErr =
+      object::FunctionIndexObjectFile::create(BufferRef, diagnosticHandler);
 
   if (std::error_code EC = ObjOrErr.getError())
-    message(LDPL_FATAL,
-            "Could not read module summary index bitcode from file : %s",
+    message(LDPL_FATAL, "Could not read function index bitcode from file : %s",
             EC.message().c_str());
 
-  object::ModuleSummaryIndexObjectFile &Obj = **ObjOrErr;
+  object::FunctionIndexObjectFile &Obj = **ObjOrErr;
 
   return Obj.takeIndex();
 }
@@ -846,8 +844,8 @@
   /// The task ID when this was invoked in a thread (ThinLTO).
   int TaskID;
 
-  /// The module summary index for ThinLTO tasks.
-  const ModuleSummaryIndex *CombinedIndex;
+  /// The function index for ThinLTO tasks.
+  const FunctionInfoIndex *CombinedIndex;
 
   /// The target machine for generating code for this module.
   std::unique_ptr<TargetMachine> TM;
@@ -864,11 +862,11 @@
   }
   /// Constructor used by ThinLTO.
   CodeGen(std::unique_ptr<llvm::Module> M, raw_fd_ostream *OS, int TaskID,
-          const ModuleSummaryIndex *CombinedIndex, std::string Filename)
+          const FunctionInfoIndex *CombinedIndex, std::string Filename)
       : M(std::move(M)), OS(OS), TaskID(TaskID), CombinedIndex(CombinedIndex),
         SaveTempsFilename(Filename) {
     assert(options::thinlto == !!CombinedIndex &&
-           "Expected module summary index iff performing ThinLTO");
+           "Expected function index iff performing ThinLTO");
     initTargetMachine();
   }
 
@@ -953,7 +951,7 @@
   PMB.LoopVectorize = true;
   PMB.SLPVectorize = true;
   PMB.OptLevel = options::OptLevel;
-  PMB.ModuleSummary = CombinedIndex;
+  PMB.FunctionIndex = CombinedIndex;
   PMB.populateLTOPassManager(passes);
   passes.run(*M);
 }
@@ -1096,7 +1094,7 @@
 static void thinLTOBackendTask(claimed_file &F, const void *View,
                                ld_plugin_input_file &File,
                                raw_fd_ostream *ApiFile,
-                               const ModuleSummaryIndex &CombinedIndex,
+                               const FunctionInfoIndex &CombinedIndex,
                                raw_fd_ostream *OS, unsigned TaskID) {
   // Need to use a separate context for each task
   LLVMContext Context;
@@ -1117,7 +1115,7 @@
 
 /// Launch each module's backend pipeline in a separate task in a thread pool.
 static void thinLTOBackends(raw_fd_ostream *ApiFile,
-                            const ModuleSummaryIndex &CombinedIndex) {
+                            const FunctionInfoIndex &CombinedIndex) {
   unsigned TaskCount = 0;
   std::vector<ThinLTOTaskInfo> Tasks;
   Tasks.reserve(Modules.size());
@@ -1186,18 +1184,18 @@
     cl::ParseCommandLineOptions(NumOpts, &options::extra[0]);
 
   // If we are doing ThinLTO compilation, simply build the combined
-  // module index/summary and emit it. We don't need to parse the modules
+  // function index/summary and emit it. We don't need to parse the modules
   // and link them in this case.
   if (options::thinlto) {
-    ModuleSummaryIndex CombinedIndex;
+    FunctionInfoIndex CombinedIndex;
     uint64_t NextModuleId = 0;
     for (claimed_file &F : Modules) {
       PluginInputFile InputFile(F.handle);
 
-      std::unique_ptr<ModuleSummaryIndex> Index =
-          getModuleSummaryIndexForFile(F, InputFile.file());
+      std::unique_ptr<FunctionInfoIndex> Index =
+          getFunctionIndexForFile(F, InputFile.file());
 
-      // Skip files without a module summary.
+      // Skip files without a function summary.
       if (Index)
         CombinedIndex.mergeFrom(std::move(Index), ++NextModuleId);
     }
diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp
index 7318bfe..d4e4d8d 100644
--- a/llvm/tools/llvm-as/llvm-as.cpp
+++ b/llvm/tools/llvm-as/llvm-as.cpp
@@ -44,9 +44,9 @@
 static cl::opt<bool>
 DisableOutput("disable-output", cl::desc("Disable output"), cl::init(false));
 
-static cl::opt<bool> EmitSummaryIndex("module-summary",
-                                      cl::desc("Emit module summary index"),
-                                      cl::init(false));
+static cl::opt<bool>
+EmitFunctionSummary("function-summary", cl::desc("Emit function summary index"),
+                    cl::init(false));
 
 static cl::opt<bool>
 DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden);
@@ -82,7 +82,7 @@
 
   if (Force || !CheckBitcodeOutputToConsole(Out->os(), true))
     WriteBitcodeToFile(M, Out->os(), PreserveBitcodeUseListOrder,
-                       EmitSummaryIndex);
+                       EmitFunctionSummary);
 
   // Declare success.
   Out->keep();
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index d886bd1..cdf057f 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/tools/llvm-link/llvm-link.cpp
@@ -12,18 +12,18 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Linker/Linker.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/IR/AutoUpgrade.h"
 #include "llvm/IR/DiagnosticInfo.h"
 #include "llvm/IR/DiagnosticPrinter.h"
+#include "llvm/IR/FunctionInfo.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
-#include "llvm/IR/ModuleSummaryIndex.h"
 #include "llvm/IR/Verifier.h"
 #include "llvm/IRReader/IRReader.h"
-#include "llvm/Linker/Linker.h"
-#include "llvm/Object/ModuleSummaryIndexObjectFile.h"
+#include "llvm/Object/FunctionIndexObjectFile.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/ManagedStatic.h"
@@ -52,14 +52,15 @@
     cl::desc("Pair of function name and filename, where function should be "
              "imported from bitcode in filename"));
 
-// Option to support testing of function importing. The module summary
+// Option to support testing of function importing. The function index
 // must be specified in the case were we request imports via the -import
 // option, as well as when compiling any module with functions that may be
 // exported (imported by a different llvm-link -import invocation), to ensure
 // consistent promotion and renaming of locals.
-static cl::opt<std::string>
-    SummaryIndex("summary-index", cl::desc("Module summary index filename"),
-                 cl::init(""), cl::value_desc("filename"));
+static cl::opt<std::string> FunctionIndex("functionindex",
+                                          cl::desc("Function index filename"),
+                                          cl::init(""),
+                                          cl::value_desc("filename"));
 
 static cl::opt<std::string>
 OutputFilename("o", cl::desc("Override output filename"), cl::init("-"),
@@ -191,10 +192,10 @@
     if (Verbose)
       errs() << "Importing " << FunctionName << " from " << FileName << "\n";
 
-    std::unique_ptr<ModuleSummaryIndex> Index;
-    if (!SummaryIndex.empty()) {
-      ErrorOr<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr =
-          llvm::getModuleSummaryIndexForFile(SummaryIndex, diagnosticHandler);
+    std::unique_ptr<FunctionInfoIndex> Index;
+    if (!FunctionIndex.empty()) {
+      ErrorOr<std::unique_ptr<FunctionInfoIndex>> IndexOrErr =
+          llvm::getFunctionIndexForFile(FunctionIndex, diagnosticHandler);
       std::error_code EC = IndexOrErr.getError();
       if (EC) {
         errs() << EC.message() << '\n';
@@ -258,12 +259,12 @@
       return false;
     }
 
-    // If a module summary index is supplied, load it so linkInModule can treat
+    // If a function index is supplied, load it so linkInModule can treat
     // local functions/variables as exported and promote if necessary.
-    std::unique_ptr<ModuleSummaryIndex> Index;
-    if (!SummaryIndex.empty()) {
-      ErrorOr<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr =
-          llvm::getModuleSummaryIndexForFile(SummaryIndex, diagnosticHandler);
+    std::unique_ptr<FunctionInfoIndex> Index;
+    if (!FunctionIndex.empty()) {
+      ErrorOr<std::unique_ptr<FunctionInfoIndex>> IndexOrErr =
+          llvm::getFunctionIndexForFile(FunctionIndex, diagnosticHandler);
       std::error_code EC = IndexOrErr.getError();
       if (EC) {
         errs() << EC.message() << '\n';
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp
index 8aadc40..f241994 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -19,9 +19,9 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IRReader/IRReader.h"
 #include "llvm/LTO/LTOCodeGenerator.h"
-#include "llvm/LTO/LTOModule.h"
 #include "llvm/LTO/ThinLTOCodeGenerator.h"
-#include "llvm/Object/ModuleSummaryIndexObjectFile.h"
+#include "llvm/LTO/LTOModule.h"
+#include "llvm/Object/FunctionIndexObjectFile.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/ManagedStatic.h"
@@ -251,16 +251,16 @@
 ///
 /// This is meant to enable testing of ThinLTO combined index generation,
 /// currently available via the gold plugin via -thinlto.
-static void createCombinedModuleSummaryIndex() {
-  ModuleSummaryIndex CombinedIndex;
+static void createCombinedFunctionIndex() {
+  FunctionInfoIndex CombinedIndex;
   uint64_t NextModuleId = 0;
   for (auto &Filename : InputFilenames) {
     CurrentActivity = "loading file '" + Filename + "'";
-    ErrorOr<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr =
-        llvm::getModuleSummaryIndexForFile(Filename, diagnosticHandler);
-    std::unique_ptr<ModuleSummaryIndex> Index = std::move(IndexOrErr.get());
+    ErrorOr<std::unique_ptr<FunctionInfoIndex>> IndexOrErr =
+        llvm::getFunctionIndexForFile(Filename, diagnosticHandler);
+    std::unique_ptr<FunctionInfoIndex> Index = std::move(IndexOrErr.get());
     CurrentActivity = "";
-    // Skip files without a module summary.
+    // Skip files without a function summary.
     if (!Index)
       continue;
     CombinedIndex.mergeFrom(std::move(Index), ++NextModuleId);
@@ -277,7 +277,7 @@
 namespace thinlto {
 
 std::vector<std::unique_ptr<MemoryBuffer>>
-loadAllFilesForIndex(const ModuleSummaryIndex &Index) {
+loadAllFilesForIndex(const FunctionInfoIndex &Index) {
   std::vector<std::unique_ptr<MemoryBuffer>> InputBuffers;
 
   for (auto &ModPath : Index.modPathStringEntries()) {
@@ -290,12 +290,12 @@
   return InputBuffers;
 }
 
-std::unique_ptr<ModuleSummaryIndex> loadCombinedIndex() {
+std::unique_ptr<FunctionInfoIndex> loadCombinedIndex() {
   if (ThinLTOIndex.empty())
     report_fatal_error("Missing -thinlto-index for ThinLTO promotion stage");
   auto CurrentActivity = "loading file '" + ThinLTOIndex + "'";
-  ErrorOr<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr =
-      llvm::getModuleSummaryIndexForFile(ThinLTOIndex, diagnosticHandler);
+  ErrorOr<std::unique_ptr<FunctionInfoIndex>> IndexOrErr =
+      llvm::getFunctionIndexForFile(ThinLTOIndex, diagnosticHandler);
   error(IndexOrErr, "error " + CurrentActivity);
   return std::move(IndexOrErr.get());
 }
@@ -557,7 +557,7 @@
   }
 
   if (ThinLTO) {
-    createCombinedModuleSummaryIndex();
+    createCombinedFunctionIndex();
     return 0;
   }