Added copyright header to all C++ source files.
[oota-llvm.git] / tools / bugpoint / CodeGeneratorBug.cpp
index 0aea9b031dad6a3961ba1d46d4754e0399551e45..60964bcfb3d44c2b184153b7c4d49c3a4f1c493e 100644 (file)
@@ -1,4 +1,12 @@
 //===- CodeGeneratorBug.cpp - Debug code generation bugs ------------------===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
+// 
 //
 // This file implements program code generation debugging support.
 //
@@ -112,8 +120,10 @@ bool ReduceMisCodegenFunctions::TestFuncs(const std::vector<Function*> &Funcs,
     // Use the function we just added to get addresses of functions we need
     // Iterate over the global declarations in the Safe module
     for (Module::iterator F=SafeModule->begin(),E=SafeModule->end(); F!=E; ++F){
-      if (F->isExternal() && !F->use_empty() && &(*F) != resolverFunc &&
-          F->getIntrinsicID() == 0 /* ignore intrinsics */) {
+      if (F->isExternal() && !F->use_empty() && &*F != resolverFunc &&
+          F->getIntrinsicID() == 0 /* ignore intrinsics */ &&
+          // Don't forward functions which are external in the test module too.
+          !TestModule->getNamedFunction(F->getName())->isExternal()) {
         // If it has a non-zero use list,
         // 1. Add a string constant with its name to the global file
         // The correct type is `const [ NUM x sbyte ]' where NUM is length of