From 124b55ddedb46d087c261f8ef84d2382a399315b Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 11 May 2010 19:58:43 +0000 Subject: [PATCH] Teach the regular pass manager how to materialize functions as needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103493 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/PassManager.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index a56938c1592..6883e9f9b12 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -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; }