1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

Respect LibraryInfo in populateLTOPassManager and use it. NFC.

llvm-svn: 216203
This commit is contained in:
Rafael Espindola 2014-08-21 18:49:52 +00:00
parent 6518040a1a
commit 43b3e883b8
2 changed files with 6 additions and 3 deletions

View File

@ -466,11 +466,9 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
mergedModule->setDataLayout(TargetMach->getSubtargetImpl()->getDataLayout());
passes.add(new DataLayoutPass(mergedModule));
// Add appropriate TargetLibraryInfo for this module.
passes.add(new TargetLibraryInfo(Triple(TargetMach->getTargetTriple())));
TargetMach->addAnalysisPasses(passes);
Triple TargetTriple(TargetMach->getTargetTriple());
// Enabling internalize here would use its AllButMain variant. It
// keeps only main if it exists and does nothing for libraries. Instead
// we create the pass ourselves with the symbol list provided by the linker.
@ -479,6 +477,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
if (!DisableInline)
PMB.Inliner = createFunctionInliningPass();
PMB.LibraryInfo = new TargetLibraryInfo(TargetTriple);
PMB.populateLTOPassManager(passes);
}

View File

@ -314,6 +314,10 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
}
void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM) {
// Add LibraryInfo if we have some.
if (LibraryInfo)
PM.add(new TargetLibraryInfo(*LibraryInfo));
// Provide AliasAnalysis services for optimizations.
addInitialAliasAnalysisPasses(PM);