diff options
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 6 | ||||
-rw-r--r-- | llvm/test/Other/new-pm-pgo.ll | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index c6ec97bdf6d..219c3835f47 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -362,6 +362,12 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level, invokePeepholeEPCallbacks(FPM, Level); + // For PGO use pipeline, try to optimize memory intrinsics such as memcpy + // using the size value profile. Don't perform this when optimizing for size. + if (PGOOpt && !PGOOpt->ProfileUseFile.empty() && + !isOptimizingForSize(Level)) + FPM.addPass(PGOMemOPSizeOpt()); + FPM.addPass(TailCallElimPass()); FPM.addPass(SimplifyCFGPass()); diff --git a/llvm/test/Other/new-pm-pgo.ll b/llvm/test/Other/new-pm-pgo.ll index 4a9d12484cd..5d6ed490250 100644 --- a/llvm/test/Other/new-pm-pgo.ll +++ b/llvm/test/Other/new-pm-pgo.ll @@ -11,6 +11,8 @@ ; ; GEN: Running pass: PGOInstrumentationGen ; USE: Running pass: PGOInstrumentationUse +; USE: Running pass: PGOIndirectCallPromotion +; USE: Running pass: PGOMemOPSizeOpt ; SAMPLE_USE_O: Running pass: ModuleToFunctionPassAdaptor<{{.*}}AddDiscriminatorsPass{{.*}}> ; SAMPLE_USE_PRE_LINK: Running pass: ModuleToFunctionPassAdaptor<{{.*}}AddDiscriminatorsPass{{.*}}> ; SAMPLE_USE: Running pass: SimplifyCFGPass |