Index: llvm/lib/Transforms/IPO/PassManagerBuilder.cpp =================================================================== --- llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -504,11 +504,12 @@ // If we are planning to perform ThinLTO later, let's not bloat the code with // unrolling/vectorization/... now. We'll first run the inliner + CGSCC passes // during ThinLTO and perform the rest of the optimizations afterward. - if (PrepareForThinLTO) { + if (PrepareForThinLTO || PrepareForLTO) { // Reduce the size of the IR as much as possible. MPM.add(createGlobalOptimizerPass()); - // Rename anon globals to be able to export them in the summary. - MPM.add(createNameAnonGlobalPass()); + if (PrepareForThinLTO) + // Rename anon globals to be able to export them in the summary. + MPM.add(createNameAnonGlobalPass()); return; } @@ -839,30 +840,8 @@ } void PassManagerBuilder::populateLTOPassManager(legacy::PassManagerBase &PM) { - PM.add(new TargetLibraryInfoWrapperPass()); - - if (VerifyInput) - PM.add(createVerifierPass()); - - if (OptLevel != 0) - addLTOOptimizationPasses(PM); - - // Create a function that performs CFI checks for cross-DSO calls with targets - // in the current module. - PM.add(createCrossDSOCFIPass()); - - // Lower type metadata and the type.test intrinsic. This pass supports Clang's - // control flow integrity mechanisms (-fsanitize=cfi*) and needs to run at - // link time if CFI is enabled. The pass does nothing if CFI is disabled. - PM.add(createLowerTypeTestsPass(Summary ? LowerTypeTestsSummaryAction::Export - : LowerTypeTestsSummaryAction::None, - Summary)); - - if (OptLevel != 0) - addLateLTOOptimizationPasses(PM); - - if (VerifyOutput) - PM.add(createVerifierPass()); + // Just use the same pipeline as ThinLTO + populateThinLTOPassManager(PM); } inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) {