diff --git a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h --- a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h +++ b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h @@ -112,6 +112,14 @@ /// passes at the end of the main CallGraphSCC passes and before any /// function simplification passes run by CGPassManager. EP_CGSCCOptimizerLate, + + /// EP_LinkTimeOptimizationStart - This extensions point allow adding passes that + /// run at Link Time, before any Link Time Optimization. + EP_LinkTimeOptimizationEarly, + + /// EP_LinkTimeOptimizationStart - This extensions point allow adding passes that + /// run at Link Time, after all Link Time Optimization. + EP_LinkTimeOptimizationLast, }; /// The Optimization Level - Specify the basic optimization level. diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -1012,6 +1012,8 @@ if (VerifyInput) PM.add(createVerifierPass()); + addExtensionsToPM(EP_LinkTimeOptimizationEarly, PM); + if (OptLevel != 0) addLTOOptimizationPasses(PM); else { @@ -1033,6 +1035,8 @@ if (OptLevel != 0) addLateLTOOptimizationPasses(PM); + addExtensionsToPM(EP_LinkTimeOptimizationLast, PM); + if (VerifyOutput) PM.add(createVerifierPass()); }