summaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-as/llvm-as.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-as/llvm-as.cpp')
-rw-r--r--llvm/tools/llvm-as/llvm-as.cpp25
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());