Fix PR637
authorChris Lattner <sabre@nondot.org>
Tue, 18 Oct 2005 06:29:43 +0000 (06:29 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 18 Oct 2005 06:29:43 +0000 (06:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23784 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gccld/GenerateCode.cpp
tools/llvm-ld/Optimize.cpp

index 72a159a1de19d84e34618846f77a2768709a52d2..0d9454937047fe4bbd5c5dd2493e7ad146ebd443 100644 (file)
@@ -216,12 +216,10 @@ int llvm::GenerateBytecode(Module *M, int StripLevel, bool Internalize,
   addPass(Passes, createFunctionResolvingPass());
 
   if (!DisableOptimizations) {
-    if (Internalize) {
-      // Now that composite has been compiled, scan through the module, looking
-      // for a main function.  If main is defined, mark all other functions
-      // internal.
-      addPass(Passes, createInternalizePass());
-    }
+    // Now that composite has been compiled, scan through the module, looking
+    // for a main function.  If main is defined, mark all other functions
+    // internal.
+    addPass(Passes, createInternalizePass(Internalize));
 
     // Now that we internalized some globals, see if we can hack on them!
     addPass(Passes, createGlobalOptimizerPass());
index 1961a95ef53f4c1b5252b4814e1f575e609e6c93..69ef608ee6bfb1b8146dfcad8ff7eff9a80ca6c4 100644 (file)
@@ -111,12 +111,10 @@ void Optimize(Module* M) {
   addPass(Passes, createFunctionResolvingPass());
 
   if (!DisableOptimizations) {
-    if (!DisableInternalize) {
-      // Now that composite has been compiled, scan through the module, looking
-      // for a main function.  If main is defined, mark all other functions
-      // internal.
-      addPass(Passes, createInternalizePass());
-    }
+    // Now that composite has been compiled, scan through the module, looking
+    // for a main function.  If main is defined, mark all other functions
+    // internal.
+    addPass(Passes, createInternalizePass(!DisableInternalize));
 
     // Now that we internalized some globals, see if we can hack on them!
     addPass(Passes, createGlobalOptimizerPass());