forked from OSchip/llvm-project
[AIX] Enable PGO without LTO
On AIX, we relied on LTO to merge the csects for profiling data/counter sections. AIX binder now get the namedcsect support to support the merging, so now we can enable PGO without LTO with the new binder. Reviewed By: Whitney Differential Revision: https://reviews.llvm.org/D110671
This commit is contained in:
parent
c0735cb9f1
commit
1e48951c73
|
@ -98,6 +98,25 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back("-bnoentry");
|
||||
}
|
||||
|
||||
// Specify PGO linker option
|
||||
if ((Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
|
||||
false) ||
|
||||
Args.hasFlag(options::OPT_fprofile_generate,
|
||||
options::OPT_fno_profile_generate, false) ||
|
||||
Args.hasFlag(options::OPT_fprofile_generate_EQ,
|
||||
options::OPT_fno_profile_generate, false) ||
|
||||
Args.hasFlag(options::OPT_fprofile_instr_generate,
|
||||
options::OPT_fno_profile_instr_generate, false) ||
|
||||
Args.hasFlag(options::OPT_fprofile_instr_generate_EQ,
|
||||
options::OPT_fno_profile_instr_generate, false) ||
|
||||
Args.hasFlag(options::OPT_fcs_profile_generate,
|
||||
options::OPT_fno_profile_generate, false) ||
|
||||
Args.hasFlag(options::OPT_fcs_profile_generate_EQ,
|
||||
options::OPT_fno_profile_generate, false) ||
|
||||
Args.hasArg(options::OPT_fcreate_profile) ||
|
||||
Args.hasArg(options::OPT_coverage)))
|
||||
CmdArgs.push_back("-bdbg:namedcsects");
|
||||
|
||||
// Specify linker output file.
|
||||
assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
|
||||
if (Output.isFilename()) {
|
||||
|
|
|
@ -795,11 +795,6 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
|
|||
}
|
||||
|
||||
if (TC.getTriple().isOSAIX()) {
|
||||
if (PGOGenerateArg)
|
||||
if (!D.isUsingLTO(false /*IsDeviceOffloadAction */) ||
|
||||
D.getLTOMode() != LTOK_Full)
|
||||
D.Diag(clang::diag::err_drv_argument_only_allowed_with)
|
||||
<< PGOGenerateArg->getSpelling() << "-flto";
|
||||
if (ProfileGenerateArg)
|
||||
D.Diag(diag::err_drv_unsupported_opt_for_target)
|
||||
<< ProfileGenerateArg->getSpelling() << TC.getTriple().str();
|
||||
|
|
|
@ -14,14 +14,6 @@
|
|||
// RUN: FileCheck %s --check-prefix=AIX-PROFILE-SAMPLE
|
||||
// AIX-PROFILE-SAMPLE: error: unsupported option '-fprofile-sample-use=' for target
|
||||
|
||||
// RUN: not %clang -fprofile-generate --target=powerpc-ibm-aix %s 2>&1 | \
|
||||
// RUN: FileCheck %s --check-prefix=AIX-PROFILE-LTO
|
||||
// AIX-PROFILE-LTO: error: invalid argument '-fprofile-generate' only allowed with '-flto'
|
||||
|
||||
// RUN: not %clang -fprofile-generate -flto=thin --target=powerpc64-ibm-aix %s 2>&1 | \
|
||||
// RUN: FileCheck %s --check-prefix=AIX-PROFILE-THINLTO
|
||||
// AIX-PROFILE-THINLTO: error: invalid argument '-fprofile-generate' only allowed with '-flto'
|
||||
|
||||
// RUN: not %clang --target=powerpc-ibm-aix %s -mlong-double-128 2>&1 | \
|
||||
// RUN: FileCheck %s --check-prefix=AIX-LONGDOUBLE128-ERR
|
||||
// AIX-LONGDOUBLE128-ERR: error: unsupported option '-mlong-double-128' for target 'powerpc-ibm-aix'
|
||||
|
|
Loading…
Reference in New Issue