Fix another variant of PR 7191. Also add a testcase
[oota-llvm.git] / tools / llvm-ld / Optimize.cpp
index a4ca95199a1c7e5312d0aa00b4f9972fb5d41819..3fb0079dfededce1c42e0ee748ce045f7bc456a2 100644 (file)
 
 #include "llvm/Module.h"
 #include "llvm/PassManager.h"
-#include "llvm/Analysis/Passes.h"
-#include "llvm/Analysis/LoopPass.h"
-#include "llvm/Analysis/Verifier.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/StandardPasses.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/System/DynamicLibrary.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
-#include "llvm/Transforms/IPO.h"
-#include "llvm/Transforms/Scalar.h"
 #include "llvm/Support/PassNameParser.h"
 #include "llvm/Support/PluginLoader.h"
-#include <iostream>
 using namespace llvm;
 
 // Pass Name Options as generated by the PassNameParser
@@ -94,7 +89,7 @@ void Optimize(Module* M) {
 
   if (!DisableOptimizations)
     createStandardLTOPasses(&Passes, !DisableInternalize, !DisableInline,
-                            /*RunSecondGlobalOpt=*/true, VerifyEach);
+                            VerifyEach);
 
   // If the -s or -S command line options were specified, strip the symbols out
   // of the resulting program to make it smaller.  -s and -S are GNU ld options
@@ -109,8 +104,8 @@ void Optimize(Module* M) {
     if (Opt->getNormalCtor())
       addPass(Passes, Opt->getNormalCtor()());
     else
-      std::cerr << "llvm-ld: cannot create pass: " << Opt->getPassName() 
-                << "\n";
+      errs() << "llvm-ld: cannot create pass: " << Opt->getPassName() 
+             << "\n";
   }
 
   // The user's passes may leave cruft around. Clean up after them them but