diff options
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
| -rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index c7557236573..6d42aac9040 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -909,6 +909,9 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( bool IsLTO = CodeGenOpts.PrepareForLTO; if (CodeGenOpts.OptimizationLevel == 0) { + if (Optional<GCOVOptions> Options = getGCOVOptions(CodeGenOpts)) + MPM.addPass(GCOVProfilerPass(*Options)); + // Build a minimal pipeline based on the semantics required by Clang, // which is just that always inlining occurs. MPM.addPass(AlwaysInlinerPass()); @@ -932,6 +935,10 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) { FPM.addPass(BoundsCheckingPass()); }); + if (Optional<GCOVOptions> Options = getGCOVOptions(CodeGenOpts)) + PB.registerPipelineStartEPCallback([Options](ModulePassManager &MPM) { + MPM.addPass(GCOVProfilerPass(*Options)); + }); if (IsThinLTO) { MPM = PB.buildThinLTOPreLinkDefaultPipeline( @@ -945,9 +952,6 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( CodeGenOpts.DebugPassManager); } } - if (Optional<GCOVOptions> Options = getGCOVOptions(CodeGenOpts)) { - MPM.addPass(GCOVProfilerPass(*Options)); - } } // FIXME: We still use the legacy pass manager to do code generation. We |

