[PATCH] D28410: [ThinLTO] Optionally ignore empty index file

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 15:48:09 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL291302: [ThinLTO] Optionally ignore empty index file (authored by tejohnson).

Changed prior to commit:
  https://reviews.llvm.org/D28410?vs=83406&id=83449#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28410

Files:
  llvm/trunk/lib/Object/ModuleSummaryIndexObjectFile.cpp


Index: llvm/trunk/lib/Object/ModuleSummaryIndexObjectFile.cpp
===================================================================
--- llvm/trunk/lib/Object/ModuleSummaryIndexObjectFile.cpp
+++ llvm/trunk/lib/Object/ModuleSummaryIndexObjectFile.cpp
@@ -22,6 +22,12 @@
 using namespace llvm;
 using namespace object;
 
+static llvm::cl::opt<bool> IgnoreEmptyThinLTOIndexFile(
+    "ignore-empty-index-file", llvm::cl::ZeroOrMore,
+    llvm::cl::desc(
+        "Ignore an empty index file and perform non-ThinLTO compilation"),
+    llvm::cl::init(false));
+
 ModuleSummaryIndexObjectFile::ModuleSummaryIndexObjectFile(
     MemoryBufferRef Object, std::unique_ptr<ModuleSummaryIndex> I)
     : SymbolicFile(Binary::ID_ModuleSummaryIndex, Object), Index(std::move(I)) {
@@ -97,6 +103,8 @@
   if (EC)
     return errorCodeToError(EC);
   MemoryBufferRef BufferRef = (FileOrErr.get())->getMemBufferRef();
+  if (IgnoreEmptyThinLTOIndexFile && !BufferRef.getBufferSize())
+    return nullptr;
   Expected<std::unique_ptr<object::ModuleSummaryIndexObjectFile>> ObjOrErr =
       object::ModuleSummaryIndexObjectFile::create(BufferRef);
   if (!ObjOrErr)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28410.83449.patch
Type: text/x-patch
Size: 1147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170106/32fee7be/attachment.bin>


More information about the llvm-commits mailing list