[llvm] 09684b0 - llvm: IPO: handle IRMover error handling, bug #45636

Sergei Trofimovich via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 25 11:16:08 PDT 2020


Author: Sergei Trofimovich
Date: 2020-04-25T19:16:01+01:00
New Revision: 09684b08d3b56b8ab0adb8fe46f709aeba29cee6

URL: https://github.com/llvm/llvm-project/commit/09684b08d3b56b8ab0adb8fe46f709aeba29cee6
DIFF: https://github.com/llvm/llvm-project/commit/09684b08d3b56b8ab0adb8fe46f709aeba29cee6.diff

LOG: llvm: IPO: handle IRMover error handling, bug #45636

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

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/FunctionImport.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 2ebd5cbd124a..a73ba84696e7 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -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++;


        


More information about the llvm-commits mailing list