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

llvm-svn: 290416
This commit is contained in:
Mehdi Amini 2016-12-23 05:16:19 +00:00
parent b2a5eb87f8
commit 96cdc49305
1 changed files with 8 additions and 0 deletions

View File

@ -697,6 +697,14 @@ Expected<bool> FunctionImporter::importFunctions(
}
}
#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;