diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2021-04-05 11:26:48 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-05-08 10:58:08 +0200 |
| commit | db140de8f2924c4ded63f0f72c0a795566d4e47c (patch) | |
| tree | 1edf737b0d275e85fa56cb2785940f17c8a9c12a /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | 5ecbe7fcf8bceb91d43a21be872aaef44c01073a (diff) | |
| download | rust-db140de8f2924c4ded63f0f72c0a795566d4e47c.tar.gz rust-db140de8f2924c4ded63f0f72c0a795566d4e47c.zip | |
Explicitly register GCOV profiling pass as well
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 7191e9a779c..355746a5582 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -32,6 +32,7 @@ #include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Instrumentation/AddressSanitizer.h" #include "llvm/Support/TimeProfiler.h" +#include "llvm/Transforms/Instrumentation/GCOVProfiler.h" #include "llvm/Transforms/Instrumentation/InstrProfiling.h" #include "llvm/Transforms/Instrumentation/ThreadSanitizer.h" #include "llvm/Transforms/Instrumentation/MemorySanitizer.h" @@ -745,7 +746,8 @@ LLVMRustOptimizeWithNewPassManager( bool MergeFunctions, bool UnrollLoops, bool SLPVectorize, bool LoopVectorize, bool DisableSimplifyLibCalls, bool EmitLifetimeMarkers, LLVMRustSanitizerOptions *SanitizerOptions, - const char *PGOGenPath, const char *PGOUsePath, bool InstrumentCoverage, + const char *PGOGenPath, const char *PGOUsePath, + bool InstrumentCoverage, bool InstrumentGCOV, void* LlvmSelfProfiler, LLVMRustSelfProfileBeforePassCallback BeforePassCallback, LLVMRustSelfProfileAfterPassCallback AfterPassCallback) { @@ -835,6 +837,14 @@ LLVMRustOptimizeWithNewPassManager( ); } + if (InstrumentGCOV) { + PipelineStartEPCallbacks.push_back( + [](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) { + MPM.addPass(GCOVProfilerPass(GCOVOptions::getDefault())); + } + ); + } + if (InstrumentCoverage) { PipelineStartEPCallbacks.push_back( [](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) { |
