fixes a crash using FPM on a Function that isn't owned by a Module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96273
91177308-0d34-0410-b5e6-
96231b3b80d8
/// 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);
}