1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

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

Differential revision: https://reviews.llvm.org/D74778
This commit is contained in:
evgeny 2020-02-26 16:34:11 +03:00
parent 897342c406
commit bd658f9fa5
2 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -90,9 +90,11 @@ static void WriteOutputFile(const Module *M, const ModuleSummaryIndex *Index) {
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