LLVM API Documentation
00001 //===- PassManagerBuilder.cpp - Build Standard Pass -----------------------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the PassManagerBuilder class, which is used to set up a 00011 // "standard" optimization sequence suitable for languages like C and C++. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 00016 #include "llvm/Transforms/IPO/PassManagerBuilder.h" 00017 #include "llvm-c/Transforms/PassManagerBuilder.h" 00018 #include "llvm/ADT/SmallVector.h" 00019 #include "llvm/Analysis/Passes.h" 00020 #include "llvm/IR/DataLayout.h" 00021 #include "llvm/IR/Verifier.h" 00022 #include "llvm/PassManager.h" 00023 #include "llvm/Support/CommandLine.h" 00024 #include "llvm/Support/ManagedStatic.h" 00025 #include "llvm/Target/TargetLibraryInfo.h" 00026 #include "llvm/Target/TargetMachine.h" 00027 #include "llvm/Target/TargetSubtargetInfo.h" 00028 #include "llvm/Transforms/IPO.h" 00029 #include "llvm/Transforms/Scalar.h" 00030 #include "llvm/Transforms/Vectorize.h" 00031 00032 using namespace llvm; 00033 00034 static cl::opt<bool> 00035 RunLoopVectorization("vectorize-loops", cl::Hidden, 00036 cl::desc("Run the Loop vectorization passes")); 00037 00038 static cl::opt<bool> 00039 RunSLPVectorization("vectorize-slp", cl::Hidden, 00040 cl::desc("Run the SLP vectorization passes")); 00041 00042 static cl::opt<bool> 00043 RunBBVectorization("vectorize-slp-aggressive", cl::Hidden, 00044 cl::desc("Run the BB vectorization passes")); 00045 00046 static cl::opt<bool> 00047 UseGVNAfterVectorization("use-gvn-after-vectorization", 00048 cl::init(false), cl::Hidden, 00049 cl::desc("Run GVN instead of Early CSE after vectorization passes")); 00050 00051 static cl::opt<bool> UseNewSROA("use-new-sroa", 00052 cl::init(true), cl::Hidden, 00053 cl::desc("Enable the new, experimental SROA pass")); 00054 00055 static cl::opt<bool> 00056 RunLoopRerolling("reroll-loops", cl::Hidden, 00057 cl::desc("Run the loop rerolling pass")); 00058 00059 static cl::opt<bool> RunLoadCombine("combine-loads", cl::init(false), 00060 cl::Hidden, 00061 cl::desc("Run the load combining pass")); 00062 00063 static cl::opt<bool> 00064 RunSLPAfterLoopVectorization("run-slp-after-loop-vectorization", 00065 cl::init(true), cl::Hidden, 00066 cl::desc("Run the SLP vectorizer (and BB vectorizer) after the Loop " 00067 "vectorizer instead of before")); 00068 00069 static cl::opt<bool> UseCFLAA("use-cfl-aa", 00070 cl::init(false), cl::Hidden, 00071 cl::desc("Enable the new, experimental CFL alias analysis")); 00072 00073 static cl::opt<bool> 00074 EnableMLSM("mlsm", cl::init(true), cl::Hidden, 00075 cl::desc("Enable motion of merged load and store")); 00076 00077 PassManagerBuilder::PassManagerBuilder() { 00078 OptLevel = 2; 00079 SizeLevel = 0; 00080 LibraryInfo = nullptr; 00081 Inliner = nullptr; 00082 DisableTailCalls = false; 00083 DisableUnitAtATime = false; 00084 DisableUnrollLoops = false; 00085 BBVectorize = RunBBVectorization; 00086 SLPVectorize = RunSLPVectorization; 00087 LoopVectorize = RunLoopVectorization; 00088 RerollLoops = RunLoopRerolling; 00089 LoadCombine = RunLoadCombine; 00090 DisableGVNLoadPRE = false; 00091 VerifyInput = false; 00092 VerifyOutput = false; 00093 StripDebug = false; 00094 MergeFunctions = false; 00095 } 00096 00097 PassManagerBuilder::~PassManagerBuilder() { 00098 delete LibraryInfo; 00099 delete Inliner; 00100 } 00101 00102 /// Set of global extensions, automatically added as part of the standard set. 00103 static ManagedStatic<SmallVector<std::pair<PassManagerBuilder::ExtensionPointTy, 00104 PassManagerBuilder::ExtensionFn>, 8> > GlobalExtensions; 00105 00106 void PassManagerBuilder::addGlobalExtension( 00107 PassManagerBuilder::ExtensionPointTy Ty, 00108 PassManagerBuilder::ExtensionFn Fn) { 00109 GlobalExtensions->push_back(std::make_pair(Ty, Fn)); 00110 } 00111 00112 void PassManagerBuilder::addExtension(ExtensionPointTy Ty, ExtensionFn Fn) { 00113 Extensions.push_back(std::make_pair(Ty, Fn)); 00114 } 00115 00116 void PassManagerBuilder::addExtensionsToPM(ExtensionPointTy ETy, 00117 PassManagerBase &PM) const { 00118 for (unsigned i = 0, e = GlobalExtensions->size(); i != e; ++i) 00119 if ((*GlobalExtensions)[i].first == ETy) 00120 (*GlobalExtensions)[i].second(*this, PM); 00121 for (unsigned i = 0, e = Extensions.size(); i != e; ++i) 00122 if (Extensions[i].first == ETy) 00123 Extensions[i].second(*this, PM); 00124 } 00125 00126 void 00127 PassManagerBuilder::addInitialAliasAnalysisPasses(PassManagerBase &PM) const { 00128 // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that 00129 // BasicAliasAnalysis wins if they disagree. This is intended to help 00130 // support "obvious" type-punning idioms. 00131 if (UseCFLAA) 00132 PM.add(createCFLAliasAnalysisPass()); 00133 PM.add(createTypeBasedAliasAnalysisPass()); 00134 PM.add(createScopedNoAliasAAPass()); 00135 PM.add(createBasicAliasAnalysisPass()); 00136 } 00137 00138 void PassManagerBuilder::populateFunctionPassManager(FunctionPassManager &FPM) { 00139 addExtensionsToPM(EP_EarlyAsPossible, FPM); 00140 00141 // Add LibraryInfo if we have some. 00142 if (LibraryInfo) FPM.add(new TargetLibraryInfo(*LibraryInfo)); 00143 00144 if (OptLevel == 0) return; 00145 00146 addInitialAliasAnalysisPasses(FPM); 00147 00148 FPM.add(createCFGSimplificationPass()); 00149 if (UseNewSROA) 00150 FPM.add(createSROAPass()); 00151 else 00152 FPM.add(createScalarReplAggregatesPass()); 00153 FPM.add(createEarlyCSEPass()); 00154 FPM.add(createLowerExpectIntrinsicPass()); 00155 } 00156 00157 void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) { 00158 // If all optimizations are disabled, just run the always-inline pass. 00159 if (OptLevel == 0) { 00160 if (Inliner) { 00161 MPM.add(Inliner); 00162 Inliner = nullptr; 00163 } 00164 00165 // FIXME: This is a HACK! The inliner pass above implicitly creates a CGSCC 00166 // pass manager, but we don't want to add extensions into that pass manager. 00167 // To prevent this we must insert a no-op module pass to reset the pass 00168 // manager to get the same behavior as EP_OptimizerLast in non-O0 builds. 00169 if (!GlobalExtensions->empty() || !Extensions.empty()) 00170 MPM.add(createBarrierNoopPass()); 00171 00172 addExtensionsToPM(EP_EnabledOnOptLevel0, MPM); 00173 return; 00174 } 00175 00176 // Add LibraryInfo if we have some. 00177 if (LibraryInfo) MPM.add(new TargetLibraryInfo(*LibraryInfo)); 00178 00179 addInitialAliasAnalysisPasses(MPM); 00180 00181 if (!DisableUnitAtATime) { 00182 addExtensionsToPM(EP_ModuleOptimizerEarly, MPM); 00183 00184 MPM.add(createIPSCCPPass()); // IP SCCP 00185 MPM.add(createGlobalOptimizerPass()); // Optimize out global vars 00186 00187 MPM.add(createDeadArgEliminationPass()); // Dead argument elimination 00188 00189 MPM.add(createInstructionCombiningPass());// Clean up after IPCP & DAE 00190 addExtensionsToPM(EP_Peephole, MPM); 00191 MPM.add(createCFGSimplificationPass()); // Clean up after IPCP & DAE 00192 } 00193 00194 // Start of CallGraph SCC passes. 00195 if (!DisableUnitAtATime) 00196 MPM.add(createPruneEHPass()); // Remove dead EH info 00197 if (Inliner) { 00198 MPM.add(Inliner); 00199 Inliner = nullptr; 00200 } 00201 if (!DisableUnitAtATime) 00202 MPM.add(createFunctionAttrsPass()); // Set readonly/readnone attrs 00203 if (OptLevel > 2) 00204 MPM.add(createArgumentPromotionPass()); // Scalarize uninlined fn args 00205 00206 // Start of function pass. 00207 // Break up aggregate allocas, using SSAUpdater. 00208 if (UseNewSROA) 00209 MPM.add(createSROAPass(/*RequiresDomTree*/ false)); 00210 else 00211 MPM.add(createScalarReplAggregatesPass(-1, false)); 00212 MPM.add(createEarlyCSEPass()); // Catch trivial redundancies 00213 MPM.add(createJumpThreadingPass()); // Thread jumps. 00214 MPM.add(createCorrelatedValuePropagationPass()); // Propagate conditionals 00215 MPM.add(createCFGSimplificationPass()); // Merge & remove BBs 00216 MPM.add(createInstructionCombiningPass()); // Combine silly seq's 00217 addExtensionsToPM(EP_Peephole, MPM); 00218 00219 if (!DisableTailCalls) 00220 MPM.add(createTailCallEliminationPass()); // Eliminate tail calls 00221 MPM.add(createCFGSimplificationPass()); // Merge & remove BBs 00222 MPM.add(createReassociatePass()); // Reassociate expressions 00223 MPM.add(createLoopRotatePass()); // Rotate Loop 00224 MPM.add(createLICMPass()); // Hoist loop invariants 00225 MPM.add(createLoopUnswitchPass(SizeLevel || OptLevel < 3)); 00226 MPM.add(createInstructionCombiningPass()); 00227 MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars 00228 MPM.add(createLoopIdiomPass()); // Recognize idioms like memset. 00229 MPM.add(createLoopDeletionPass()); // Delete dead loops 00230 00231 if (!DisableUnrollLoops) 00232 MPM.add(createSimpleLoopUnrollPass()); // Unroll small loops 00233 addExtensionsToPM(EP_LoopOptimizerEnd, MPM); 00234 00235 if (OptLevel > 1) { 00236 if (EnableMLSM) 00237 MPM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds 00238 MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies 00239 } 00240 MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset 00241 MPM.add(createSCCPPass()); // Constant prop with SCCP 00242 00243 // Run instcombine after redundancy elimination to exploit opportunities 00244 // opened up by them. 00245 MPM.add(createInstructionCombiningPass()); 00246 addExtensionsToPM(EP_Peephole, MPM); 00247 MPM.add(createJumpThreadingPass()); // Thread jumps 00248 MPM.add(createCorrelatedValuePropagationPass()); 00249 MPM.add(createDeadStoreEliminationPass()); // Delete dead stores 00250 00251 addExtensionsToPM(EP_ScalarOptimizerLate, MPM); 00252 00253 if (RerollLoops) 00254 MPM.add(createLoopRerollPass()); 00255 if (!RunSLPAfterLoopVectorization) { 00256 if (SLPVectorize) 00257 MPM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains. 00258 00259 if (BBVectorize) { 00260 MPM.add(createBBVectorizePass()); 00261 MPM.add(createInstructionCombiningPass()); 00262 addExtensionsToPM(EP_Peephole, MPM); 00263 if (OptLevel > 1 && UseGVNAfterVectorization) 00264 MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies 00265 else 00266 MPM.add(createEarlyCSEPass()); // Catch trivial redundancies 00267 00268 // BBVectorize may have significantly shortened a loop body; unroll again. 00269 if (!DisableUnrollLoops) 00270 MPM.add(createLoopUnrollPass()); 00271 } 00272 } 00273 00274 if (LoadCombine) 00275 MPM.add(createLoadCombinePass()); 00276 00277 MPM.add(createAggressiveDCEPass()); // Delete dead instructions 00278 MPM.add(createCFGSimplificationPass()); // Merge & remove BBs 00279 MPM.add(createInstructionCombiningPass()); // Clean up after everything. 00280 addExtensionsToPM(EP_Peephole, MPM); 00281 00282 // FIXME: This is a HACK! The inliner pass above implicitly creates a CGSCC 00283 // pass manager that we are specifically trying to avoid. To prevent this 00284 // we must insert a no-op module pass to reset the pass manager. 00285 MPM.add(createBarrierNoopPass()); 00286 MPM.add(createLoopVectorizePass(DisableUnrollLoops, LoopVectorize)); 00287 // FIXME: Because of #pragma vectorize enable, the passes below are always 00288 // inserted in the pipeline, even when the vectorizer doesn't run (ex. when 00289 // on -O1 and no #pragma is found). Would be good to have these two passes 00290 // as function calls, so that we can only pass them when the vectorizer 00291 // changed the code. 00292 MPM.add(createInstructionCombiningPass()); 00293 00294 if (RunSLPAfterLoopVectorization) { 00295 if (SLPVectorize) 00296 MPM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains. 00297 00298 if (BBVectorize) { 00299 MPM.add(createBBVectorizePass()); 00300 MPM.add(createInstructionCombiningPass()); 00301 addExtensionsToPM(EP_Peephole, MPM); 00302 if (OptLevel > 1 && UseGVNAfterVectorization) 00303 MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies 00304 else 00305 MPM.add(createEarlyCSEPass()); // Catch trivial redundancies 00306 00307 // BBVectorize may have significantly shortened a loop body; unroll again. 00308 if (!DisableUnrollLoops) 00309 MPM.add(createLoopUnrollPass()); 00310 } 00311 } 00312 00313 addExtensionsToPM(EP_Peephole, MPM); 00314 MPM.add(createCFGSimplificationPass()); 00315 00316 if (!DisableUnrollLoops) 00317 MPM.add(createLoopUnrollPass()); // Unroll small loops 00318 00319 // After vectorization and unrolling, assume intrinsics may tell us more 00320 // about pointer alignments. 00321 MPM.add(createAlignmentFromAssumptionsPass()); 00322 00323 if (!DisableUnitAtATime) { 00324 // FIXME: We shouldn't bother with this anymore. 00325 MPM.add(createStripDeadPrototypesPass()); // Get rid of dead prototypes 00326 00327 // GlobalOpt already deletes dead functions and globals, at -O2 try a 00328 // late pass of GlobalDCE. It is capable of deleting dead cycles. 00329 if (OptLevel > 1) { 00330 MPM.add(createGlobalDCEPass()); // Remove dead fns and globals. 00331 MPM.add(createConstantMergePass()); // Merge dup global constants 00332 } 00333 } 00334 00335 if (MergeFunctions) 00336 MPM.add(createMergeFunctionsPass()); 00337 00338 addExtensionsToPM(EP_OptimizerLast, MPM); 00339 } 00340 00341 void PassManagerBuilder::addLTOOptimizationPasses(PassManagerBase &PM) { 00342 // Provide AliasAnalysis services for optimizations. 00343 addInitialAliasAnalysisPasses(PM); 00344 00345 // Propagate constants at call sites into the functions they call. This 00346 // opens opportunities for globalopt (and inlining) by substituting function 00347 // pointers passed as arguments to direct uses of functions. 00348 PM.add(createIPSCCPPass()); 00349 00350 // Now that we internalized some globals, see if we can hack on them! 00351 PM.add(createGlobalOptimizerPass()); 00352 00353 // Linking modules together can lead to duplicated global constants, only 00354 // keep one copy of each constant. 00355 PM.add(createConstantMergePass()); 00356 00357 // Remove unused arguments from functions. 00358 PM.add(createDeadArgEliminationPass()); 00359 00360 // Reduce the code after globalopt and ipsccp. Both can open up significant 00361 // simplification opportunities, and both can propagate functions through 00362 // function pointers. When this happens, we often have to resolve varargs 00363 // calls, etc, so let instcombine do this. 00364 PM.add(createInstructionCombiningPass()); 00365 addExtensionsToPM(EP_Peephole, PM); 00366 00367 // Inline small functions 00368 bool RunInliner = Inliner; 00369 if (RunInliner) { 00370 PM.add(Inliner); 00371 Inliner = nullptr; 00372 } 00373 00374 PM.add(createPruneEHPass()); // Remove dead EH info. 00375 00376 // Optimize globals again if we ran the inliner. 00377 if (RunInliner) 00378 PM.add(createGlobalOptimizerPass()); 00379 PM.add(createGlobalDCEPass()); // Remove dead functions. 00380 00381 // If we didn't decide to inline a function, check to see if we can 00382 // transform it to pass arguments by value instead of by reference. 00383 PM.add(createArgumentPromotionPass()); 00384 00385 // The IPO passes may leave cruft around. Clean up after them. 00386 PM.add(createInstructionCombiningPass()); 00387 addExtensionsToPM(EP_Peephole, PM); 00388 PM.add(createJumpThreadingPass()); 00389 00390 // Break up allocas 00391 if (UseNewSROA) 00392 PM.add(createSROAPass()); 00393 else 00394 PM.add(createScalarReplAggregatesPass()); 00395 00396 // Run a few AA driven optimizations here and now, to cleanup the code. 00397 PM.add(createFunctionAttrsPass()); // Add nocapture. 00398 PM.add(createGlobalsModRefPass()); // IP alias analysis. 00399 00400 PM.add(createLICMPass()); // Hoist loop invariants. 00401 if (EnableMLSM) 00402 PM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds. 00403 PM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies. 00404 PM.add(createMemCpyOptPass()); // Remove dead memcpys. 00405 00406 // Nuke dead stores. 00407 PM.add(createDeadStoreEliminationPass()); 00408 00409 // More loops are countable; try to optimize them. 00410 PM.add(createIndVarSimplifyPass()); 00411 PM.add(createLoopDeletionPass()); 00412 PM.add(createLoopVectorizePass(true, true)); 00413 00414 // More scalar chains could be vectorized due to more alias information 00415 PM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains. 00416 00417 // After vectorization, assume intrinsics may tell us more about pointer 00418 // alignments. 00419 PM.add(createAlignmentFromAssumptionsPass()); 00420 00421 if (LoadCombine) 00422 PM.add(createLoadCombinePass()); 00423 00424 // Cleanup and simplify the code after the scalar optimizations. 00425 PM.add(createInstructionCombiningPass()); 00426 addExtensionsToPM(EP_Peephole, PM); 00427 00428 PM.add(createJumpThreadingPass()); 00429 00430 // Delete basic blocks, which optimization passes may have killed. 00431 PM.add(createCFGSimplificationPass()); 00432 00433 // Now that we have optimized the program, discard unreachable functions. 00434 PM.add(createGlobalDCEPass()); 00435 00436 // FIXME: this is profitable (for compiler time) to do at -O0 too, but 00437 // currently it damages debug info. 00438 if (MergeFunctions) 00439 PM.add(createMergeFunctionsPass()); 00440 } 00441 00442 void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM, 00443 TargetMachine *TM) { 00444 if (TM) { 00445 PM.add(new DataLayoutPass()); 00446 TM->addAnalysisPasses(PM); 00447 } 00448 00449 if (LibraryInfo) 00450 PM.add(new TargetLibraryInfo(*LibraryInfo)); 00451 00452 if (VerifyInput) 00453 PM.add(createVerifierPass()); 00454 00455 if (StripDebug) 00456 PM.add(createStripSymbolsPass(true)); 00457 00458 if (VerifyInput) 00459 PM.add(createDebugInfoVerifierPass()); 00460 00461 if (OptLevel != 0) 00462 addLTOOptimizationPasses(PM); 00463 00464 if (VerifyOutput) { 00465 PM.add(createVerifierPass()); 00466 PM.add(createDebugInfoVerifierPass()); 00467 } 00468 } 00469 00470 inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) { 00471 return reinterpret_cast<PassManagerBuilder*>(P); 00472 } 00473 00474 inline LLVMPassManagerBuilderRef wrap(PassManagerBuilder *P) { 00475 return reinterpret_cast<LLVMPassManagerBuilderRef>(P); 00476 } 00477 00478 LLVMPassManagerBuilderRef LLVMPassManagerBuilderCreate() { 00479 PassManagerBuilder *PMB = new PassManagerBuilder(); 00480 return wrap(PMB); 00481 } 00482 00483 void LLVMPassManagerBuilderDispose(LLVMPassManagerBuilderRef PMB) { 00484 PassManagerBuilder *Builder = unwrap(PMB); 00485 delete Builder; 00486 } 00487 00488 void 00489 LLVMPassManagerBuilderSetOptLevel(LLVMPassManagerBuilderRef PMB, 00490 unsigned OptLevel) { 00491 PassManagerBuilder *Builder = unwrap(PMB); 00492 Builder->OptLevel = OptLevel; 00493 } 00494 00495 void 00496 LLVMPassManagerBuilderSetSizeLevel(LLVMPassManagerBuilderRef PMB, 00497 unsigned SizeLevel) { 00498 PassManagerBuilder *Builder = unwrap(PMB); 00499 Builder->SizeLevel = SizeLevel; 00500 } 00501 00502 void 00503 LLVMPassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB, 00504 LLVMBool Value) { 00505 PassManagerBuilder *Builder = unwrap(PMB); 00506 Builder->DisableUnitAtATime = Value; 00507 } 00508 00509 void 00510 LLVMPassManagerBuilderSetDisableUnrollLoops(LLVMPassManagerBuilderRef PMB, 00511 LLVMBool Value) { 00512 PassManagerBuilder *Builder = unwrap(PMB); 00513 Builder->DisableUnrollLoops = Value; 00514 } 00515 00516 void 00517 LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef PMB, 00518 LLVMBool Value) { 00519 // NOTE: The simplify-libcalls pass has been removed. 00520 } 00521 00522 void 00523 LLVMPassManagerBuilderUseInlinerWithThreshold(LLVMPassManagerBuilderRef PMB, 00524 unsigned Threshold) { 00525 PassManagerBuilder *Builder = unwrap(PMB); 00526 Builder->Inliner = createFunctionInliningPass(Threshold); 00527 } 00528 00529 void 00530 LLVMPassManagerBuilderPopulateFunctionPassManager(LLVMPassManagerBuilderRef PMB, 00531 LLVMPassManagerRef PM) { 00532 PassManagerBuilder *Builder = unwrap(PMB); 00533 FunctionPassManager *FPM = unwrap<FunctionPassManager>(PM); 00534 Builder->populateFunctionPassManager(*FPM); 00535 } 00536 00537 void 00538 LLVMPassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef PMB, 00539 LLVMPassManagerRef PM) { 00540 PassManagerBuilder *Builder = unwrap(PMB); 00541 PassManagerBase *MPM = unwrap(PM); 00542 Builder->populateModulePassManager(*MPM); 00543 } 00544 00545 void LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB, 00546 LLVMPassManagerRef PM, 00547 LLVMBool Internalize, 00548 LLVMBool RunInliner) { 00549 PassManagerBuilder *Builder = unwrap(PMB); 00550 PassManagerBase *LPM = unwrap(PM); 00551 00552 // A small backwards compatibility hack. populateLTOPassManager used to take 00553 // an RunInliner option. 00554 if (RunInliner && !Builder->Inliner) 00555 Builder->Inliner = createFunctionInliningPass(); 00556 00557 Builder->populateLTOPassManager(*LPM); 00558 }