There is no reason to try to materialize the function from bytecode if it
authorChris Lattner <sabre@nondot.org>
Mon, 15 Nov 2004 23:18:09 +0000 (23:18 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 15 Nov 2004 23:18:09 +0000 (23:18 +0000)
already has been.  This may be a small speedup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17863 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/JIT/JIT.cpp

index d9866c87ee4225a83189a76ef5cf28f13cf02536..71f1dd0d6b345a7035eb87b4b26aa52e56a87b03 100644 (file)
@@ -239,15 +239,18 @@ void *JIT::getPointerToFunction(Function *F) {
     return Addr;   // Check if function already code gen'd
 
   // Make sure we read in the function if it exists in this Module
-  try {
-    MP->materializeFunction(F);
-  } catch ( std::string& errmsg ) {
-    std::cerr << "Error reading bytecode file: " << errmsg << "\n";
-    abort();
-  } catch (...) {
-    std::cerr << "Error reading bytecode file!\n";
-    abort();
-  }
+  if (F->hasNotBeenReadFromBytecode()) 
+    try {
+      MP->materializeFunction(F);
+    } catch ( std::string& errmsg ) {
+      std::cerr << "Error reading function '" << F->getName()
+                << "' from bytecode file: " << errmsg << "\n";
+      abort();
+    } catch (...) {
+      std::cerr << "Error reading function '" << F->getName()
+                << "from bytecode file!\n";
+      abort();
+    }
 
   if (F->isExternal()) {
     void *Addr = getPointerToNamedFunction(F->getName());