[PATCH] D74778: [Assembler] Allow assembling empty index with non-zero flags

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 05:50:12 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8f8756d465e4: [Assembler] Allow assembling empty index with non-zero flags (authored by evgeny777).

Changed prior to commit:
  https://reviews.llvm.org/D74778?vs=245192&id=246686#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74778/new/

https://reviews.llvm.org/D74778

Files:
  llvm/test/Assembler/summary-flags2.ll
  llvm/tools/llvm-as/llvm-as.cpp


Index: llvm/tools/llvm-as/llvm-as.cpp
===================================================================
--- llvm/tools/llvm-as/llvm-as.cpp
+++ llvm/tools/llvm-as/llvm-as.cpp
@@ -90,9 +90,11 @@
 
   if (Force || !CheckBitcodeOutputToConsole(Out->os(), true)) {
     const ModuleSummaryIndex *IndexToWrite = nullptr;
-    // Don't attempt to write a summary index unless it contains any entries.
-    // Otherwise we get an empty summary section.
-    if (Index && Index->begin() != Index->end())
+    // Don't attempt to write a summary index unless it contains any entries or
+    // has non-zero flags. The latter is used to assemble dummy index files for
+    // skipping modules by distributed ThinLTO backends. Otherwise we get an empty
+    // summary section.
+    if (Index && (Index->begin() != Index->end() || Index->getFlags()))
       IndexToWrite = Index;
     if (!IndexToWrite || (M && (!M->empty() || !M->global_empty())))
       // If we have a non-empty Module, then we write the Module plus
Index: llvm/test/Assembler/summary-flags2.ll
===================================================================
--- /dev/null
+++ llvm/test/Assembler/summary-flags2.ll
@@ -0,0 +1,8 @@
+; Check that we can assemble/disassemble empty index with non-trivial flags
+; RUN: llvm-as %s -o - | llvm-dis -o - | FileCheck %s
+
+; ModuleID = 'index.bc'
+source_filename = "index.bc"
+
+^0 = flags: 2
+; CHECK: ^0 = flags: 2


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74778.246686.patch
Type: text/x-patch
Size: 1426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200226/6b024289/attachment.bin>


More information about the llvm-commits mailing list