forked from OSchip/llvm-project
Using addPassesToEmitWholeFile is not a good idea here.
Use FunctionPassManager to do the job. llvm-svn: 30160
This commit is contained in:
parent
ce2c1eb154
commit
5606dd8a45
|
@ -282,11 +282,24 @@ static enum LTOStatus lto_optimize(Module *M, std::ostream &Out,
|
||||||
// Make sure everything is still good.
|
// Make sure everything is still good.
|
||||||
Passes.add(createVerifierPass());
|
Passes.add(createVerifierPass());
|
||||||
|
|
||||||
Target.addPassesToEmitWholeFile(Passes, Out, TargetMachine::AssemblyFile, true);
|
FunctionPassManager *CodeGenPasses =
|
||||||
|
new FunctionPassManager(new ExistingModuleProvider(M));
|
||||||
|
|
||||||
|
CodeGenPasses->add(new TargetData(*Target.getTargetData()));
|
||||||
|
Target.addPassesToEmitFile(*CodeGenPasses, Out, TargetMachine::AssemblyFile,
|
||||||
|
true);
|
||||||
|
|
||||||
// Run our queue of passes all at once now, efficiently.
|
// Run our queue of passes all at once now, efficiently.
|
||||||
Passes.run(*M);
|
Passes.run(*M);
|
||||||
|
|
||||||
|
// Run the code generator, if present.
|
||||||
|
CodeGenPasses->doInitialization();
|
||||||
|
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
|
||||||
|
if (!I->isExternal())
|
||||||
|
CodeGenPasses->run(*I);
|
||||||
|
}
|
||||||
|
CodeGenPasses->doFinalization();
|
||||||
|
|
||||||
return LTO_OPT_SUCCESS;
|
return LTO_OPT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue