[llvm] r290416 - [ThinLTO] Verify lazy-loaded source module for function importing when assertions are enabled (NFC)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 22 21:16:20 PST 2016


Author: mehdi_amini
Date: Thu Dec 22 23:16:19 2016
New Revision: 290416

URL: http://llvm.org/viewvc/llvm-project?rev=290416&view=rev
Log:
[ThinLTO] Verify lazy-loaded source module for function importing when assertions are enabled (NFC)

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

Modified: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp?rev=290416&r1=290415&r2=290416&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp Thu Dec 22 23:16:19 2016
@@ -697,6 +697,14 @@ Expected<bool> FunctionImporter::importF
       }
     }
 
+#ifndef DEBUG
+    // Note: this can't be done after `renameModuleForThinLTO` as it leaves the
+    // module in a state that does not pass the verifier (for example aliases
+    // pointing to available_externally functions).
+    if (verifyModule(*SrcModule, &errs()))
+      report_fatal_error("Invalid lazy-loaded source module for importing");
+#endif
+
     // Link in the specified functions.
     if (renameModuleForThinLTO(*SrcModule, Index, &GlobalsToImport))
       return true;




More information about the llvm-commits mailing list