mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 16:41:06 +03:00
PGO: Add IR-based PGO.
This commit is contained in:
parent
3ec79179b4
commit
e8e28b33b2
5 changed files with 104 additions and 4 deletions
|
@ -207,7 +207,8 @@ static void addSanitizerCoveragePass(const PassManagerBuilder &Builder,
|
|||
}
|
||||
|
||||
// Adds PGO instrumentation generation and use passes.
|
||||
static void addPGOPasses(legacy::PassManagerBase &mpm, unsigned optLevel) {
|
||||
static void addPGOPasses(PassManagerBuilder &builder,
|
||||
legacy::PassManagerBase &mpm, unsigned optLevel) {
|
||||
if (opts::isInstrumentingForASTBasedPGO()) {
|
||||
InstrProfOptions options;
|
||||
options.NoRedZone = global.params.disableRedZone;
|
||||
|
@ -227,6 +228,16 @@ static void addPGOPasses(legacy::PassManagerBase &mpm, unsigned optLevel) {
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#if LDC_LLVM_VER >= 309
|
||||
else if (opts::isInstrumentingForIRBasedPGO()) {
|
||||
#if LDC_LLVM_VER >= 400
|
||||
builder.EnablePGOInstrGen = true;
|
||||
#endif
|
||||
builder.PGOInstrGen = global.params.datafileInstrProf;
|
||||
} else if (opts::isUsingIRBasedPGOProfile()) {
|
||||
builder.PGOInstrUse = global.params.datafileInstrProf;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -328,7 +339,7 @@ static void addOptimizationPasses(legacy::PassManagerBase &mpm,
|
|||
builder.addExtension(PassManagerBuilder::EP_OptimizerLast,
|
||||
addStripExternalsPass);
|
||||
|
||||
addPGOPasses(mpm, optLevel);
|
||||
addPGOPasses(builder, mpm, optLevel);
|
||||
|
||||
builder.populateFunctionPassManager(fpm);
|
||||
builder.populateModulePassManager(mpm);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue