Teach the regular pass manager how to materialize functions as needed.

llvm-svn: 103493
This commit is contained in:
Dan Gohman 2010-05-11 19:58:43 +00:00
parent 4cfccb801c
commit 860d669da2
1 changed files with 9 additions and 1 deletions

View File

@ -1444,8 +1444,16 @@ bool FPPassManager::runOnFunction(Function &F) {
bool FPPassManager::runOnModule(Module &M) {
bool Changed = doInitialization(M);
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
Function &F = *I;
if (F.isMaterializable()) {
std::string errstr;
if (F.Materialize(&errstr))
report_fatal_error("Error reading bitcode file: " + Twine(errstr));
}
runOnFunction(*I);
}
return doFinalization(M) || Changed;
}