Don't try to materialize a function that isn't materializable anyways. This

fixes a crash using FPM on a Function that isn't owned by a Module.

llvm-svn: 96273
This commit is contained in:
Nick Lewycky 2010-02-15 21:27:56 +00:00
parent 780d2fe319
commit 94e168f09e
1 changed files with 5 additions and 3 deletions

View File

@ -1220,9 +1220,11 @@ void FunctionPassManager::add(Pass *P) {
/// so, return true.
///
bool FunctionPassManager::run(Function &F) {
std::string errstr;
if (F.Materialize(&errstr)) {
llvm_report_error("Error reading bitcode file: " + errstr);
if (F.isMaterializable()) {
std::string errstr;
if (F.Materialize(&errstr)) {
llvm_report_error("Error reading bitcode file: " + errstr);
}
}
return FPM->run(F);
}