mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-09 04:15:58 +03:00
PGO: refactor such that there can be IR-based and frontend-based PGO.
This commit is contained in:
parent
07b7abefa4
commit
3ec79179b4
13 changed files with 94 additions and 49 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "errors.h"
|
||||
#include "driver/cl_options.h"
|
||||
#include "driver/cl_options_instrumentation.h"
|
||||
#include "driver/cl_options_sanitizers.h"
|
||||
#include "driver/exe_path.h"
|
||||
#include "driver/tool.h"
|
||||
|
@ -329,7 +330,7 @@ void ArgsBuilder::build(llvm::StringRef outputPath,
|
|||
}
|
||||
|
||||
// Link with profile-rt library when generating an instrumented binary.
|
||||
if (global.params.genInstrProf) {
|
||||
if (opts::isInstrumentingForPGO()) {
|
||||
#if LDC_LLVM_VER >= 308
|
||||
if (global.params.targetTriple->isOSLinux()) {
|
||||
// For Linux, explicitly define __llvm_profile_runtime as undefined
|
||||
|
@ -386,7 +387,7 @@ void ArgsBuilder::build(llvm::StringRef outputPath,
|
|||
// instrumented binary. The runtime relies on magic sections, which
|
||||
// would be stripped by gc-section on older version of ld, see bug:
|
||||
// https://sourceware.org/bugzilla/show_bug.cgi?id=19161
|
||||
if (!opts::disableLinkerStripDead && !global.params.genInstrProf) {
|
||||
if (!opts::disableLinkerStripDead && !opts::isInstrumentingForPGO()) {
|
||||
addLdFlag("--gc-sections");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue