[llvm] r216203 - Respect LibraryInfo in populateLTOPassManager and use it. NFC.
Rafael Espindola
rafael.espindola at gmail.com
Thu Aug 21 11:49:52 PDT 2014
Author: rafael
Date: Thu Aug 21 13:49:52 2014
New Revision: 216203
URL: http://llvm.org/viewvc/llvm-project?rev=216203&view=rev
Log:
Respect LibraryInfo in populateLTOPassManager and use it. NFC.
Modified:
llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=216203&r1=216202&r2=216203&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Thu Aug 21 13:49:52 2014
@@ -466,11 +466,9 @@ bool LTOCodeGenerator::generateObjectFil
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::generateObjectFil
PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
if (!DisableInline)
PMB.Inliner = createFunctionInliningPass();
+ PMB.LibraryInfo = new TargetLibraryInfo(TargetTriple);
PMB.populateLTOPassManager(passes);
}
Modified: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=216203&r1=216202&r2=216203&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Thu Aug 21 13:49:52 2014
@@ -314,6 +314,10 @@ void PassManagerBuilder::populateModuleP
}
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);
More information about the llvm-commits
mailing list