Skip to content

Commit

Permalink
llvm: IPO: handle IRMover error handling, bug #45636
Browse files Browse the repository at this point in the history
Summary:
Missing error mangling is noticed in
https://bugs.llvm.org/show_bug.cgi?id=45636
where inconsistent profiling input caused
llvm/lld to crash as:

```
Program aborted due to an unhandled Error:
linking module flags 'ProfileSummary':
  IDs have conflicting values in 'Mutex_posix.o' and 'nsBrowserApp.o'
```

The change does not change the fact that LLVM crashes
but changes error output to say what was incorrect:

```
LLVM ERROR: Function Import: link error:
  linking module flags 'ProfileSummary':
    IDs have conflicting values in 'Mutex_posix.o' and 'nsBrowserApp.o'
```

Actual crash has yet to be fixed.

Reviewers: lattner

Reviewed By: lattner

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78676
  • Loading branch information
Sergei Trofimovich authored and Sergei Trofimovich committed Apr 25, 2020
1 parent 3a1afd8 commit 09684b0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions llvm/lib/Transforms/IPO/FunctionImport.cpp
Expand Up @@ -1243,10 +1243,12 @@ Expected<bool> FunctionImporter::importFunctions(
<< " from " << SrcModule->getSourceFileName() << "\n";
}

if (Mover.move(std::move(SrcModule), GlobalsToImport.getArrayRef(),
[](GlobalValue &, IRMover::ValueAdder) {},
/*IsPerformingImport=*/true))
report_fatal_error("Function Import: link error");
if (Error Err = Mover.move(
std::move(SrcModule), GlobalsToImport.getArrayRef(),
[](GlobalValue &, IRMover::ValueAdder) {},
/*IsPerformingImport=*/true))
report_fatal_error("Function Import: link error: " +
toString(std::move(Err)));

ImportedCount += GlobalsToImport.size();
NumImportedModules++;
Expand Down

0 comments on commit 09684b0

Please sign in to comment.