diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
commit | cfca06d7963fa0909f90483b42a6d7d194d01e08 (patch) | |
tree | 209fb2a2d68f8f277793fc8df46c753d31bc853b /llvm/tools/llvm-as/llvm-as.cpp | |
parent | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff) |
Notes
Diffstat (limited to 'llvm/tools/llvm-as/llvm-as.cpp')
-rw-r--r-- | llvm/tools/llvm-as/llvm-as.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp index c9f50e38fc618..f2b52890a7f5c 100644 --- a/llvm/tools/llvm-as/llvm-as.cpp +++ b/llvm/tools/llvm-as/llvm-as.cpp @@ -88,11 +88,13 @@ static void WriteOutputFile(const Module *M, const ModuleSummaryIndex *Index) { exit(1); } - if (Force || !CheckBitcodeOutputToConsole(Out->os(), true)) { + if (Force || !CheckBitcodeOutputToConsole(Out->os())) { 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 @@ -119,8 +121,19 @@ int main(int argc, char **argv) { // Parse the file now... SMDiagnostic Err; - auto ModuleAndIndex = parseAssemblyFileWithIndex( - InputFilename, Err, Context, nullptr, !DisableVerify, ClDataLayout); + auto SetDataLayout = [](StringRef) -> Optional<std::string> { + if (ClDataLayout.empty()) + return None; + return ClDataLayout; + }; + ParsedModuleAndIndex ModuleAndIndex; + if (DisableVerify) { + ModuleAndIndex = parseAssemblyFileWithIndexNoUpgradeDebugInfo( + InputFilename, Err, Context, nullptr, SetDataLayout); + } else { + ModuleAndIndex = parseAssemblyFileWithIndex(InputFilename, Err, Context, + nullptr, SetDataLayout); + } std::unique_ptr<Module> M = std::move(ModuleAndIndex.Mod); if (!M.get()) { Err.print(argv[0], errs()); |