diff options
| author | David Blaikie <dblaikie@gmail.com> | 2018-01-23 01:25:24 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2018-01-23 01:25:24 +0000 |
| commit | ac904d0e3a94828f5e7dd2f618bfc4c8ab699bd5 (patch) | |
| tree | 91ed2ee5b6480c6ae29733e133225039358725e1 /clang/lib/CodeGen | |
| parent | 0c64f5a2eba6ed11c1e04cfbb19ab8dcf0a469ed (diff) | |
| download | bcm5719-llvm-ac904d0e3a94828f5e7dd2f618bfc4c8ab699bd5.tar.gz bcm5719-llvm-ac904d0e3a94828f5e7dd2f618bfc4c8ab699bd5.zip | |
NewPM: Improve/fix GCOV - which needs to run early in the pass pipeline.
Using a new extension point in the new PM, register GCOV at the start of
the pipeline rather than the end.
llvm-svn: 323167
Diffstat (limited to 'clang/lib/CodeGen')
| -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 |

