[llvm-commits] [llvm] r96273 - /llvm/trunk/lib/VMCore/PassManager.cpp

Nick Lewycky nicholas at mxc.ca
Mon Feb 15 13:27:57 PST 2010


Author: nicholas
Date: Mon Feb 15 15:27:56 2010
New Revision: 96273

URL: http://llvm.org/viewvc/llvm-project?rev=96273&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/VMCore/PassManager.cpp

Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=96273&r1=96272&r2=96273&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Feb 15 15:27:56 2010
@@ -1220,9 +1220,11 @@
 /// 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);
 }





More information about the llvm-commits mailing list