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.
PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
if (!DisableInline)
PMB.Inliner = createFunctionInliningPass();
+ PMB.LibraryInfo = new TargetLibraryInfo(TargetTriple);
PMB.populateLTOPassManager(passes);
}
}
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);