1
Fork 0

Explicitly register instrprof pass

Don't use "passes" for this purpose, explicitly insert it into
the correct place in the pipeline instead.
This commit is contained in:
Nikita Popov 2021-04-05 10:45:04 +02:00
parent 0318883cd6
commit 5ecbe7fcf8
4 changed files with 20 additions and 8 deletions

View file

@ -32,6 +32,7 @@
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/Instrumentation/AddressSanitizer.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Transforms/Instrumentation/InstrProfiling.h"
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
#include "llvm/Transforms/Instrumentation/HWAddressSanitizer.h"
@ -744,7 +745,7 @@ LLVMRustOptimizeWithNewPassManager(
bool MergeFunctions, bool UnrollLoops, bool SLPVectorize, bool LoopVectorize,
bool DisableSimplifyLibCalls, bool EmitLifetimeMarkers,
LLVMRustSanitizerOptions *SanitizerOptions,
const char *PGOGenPath, const char *PGOUsePath,
const char *PGOGenPath, const char *PGOUsePath, bool InstrumentCoverage,
void* LlvmSelfProfiler,
LLVMRustSelfProfileBeforePassCallback BeforePassCallback,
LLVMRustSelfProfileAfterPassCallback AfterPassCallback) {
@ -834,6 +835,15 @@ LLVMRustOptimizeWithNewPassManager(
);
}
if (InstrumentCoverage) {
PipelineStartEPCallbacks.push_back(
[](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
InstrProfOptions Options;
MPM.addPass(InstrProfiling(Options, false));
}
);
}
if (SanitizerOptions) {
if (SanitizerOptions->SanitizeMemory) {
MemorySanitizerOptions Options(