1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

[PGO] Add flags to control IRPGO warnings.

Currently there is no reasonable way to control the warnings in the 'use' phase
of the IRPGO pass. This is problematic because the output can be somewhat
spammy. This patch adds some flags which allow us to optionally disable these
warnings. The current upstream behavior will remain the default.

Patch by Jake VanAdrighem (jvanadrighem@gmail.com)

Differential Revision: http://reviews.llvm.org/D20195

llvm-svn: 269437
This commit is contained in:
Rong Xu 2016-05-13 17:26:06 +00:00
parent e56b6e0df5
commit 6b6df5666a

View File

@ -111,6 +111,16 @@ static cl::opt<unsigned> MaxNumAnnotations(
cl::desc("Max number of annotations for a single indirect "
"call callsite"));
// Command line option to enable/disable the warning about missing profile
// information.
static cl::opt<bool> NoPGOWarnMissing("no-pgo-warn-missing", cl::init(false),
cl::Hidden);
// Command line option to enable/disable the warning about a hash mismatch in
// the profile data.
static cl::opt<bool> NoPGOWarnMismatch("no-pgo-warn-mismatch", cl::init(false),
cl::Hidden);
namespace {
class PGOInstrumentationGenLegacyPass : public ModulePass {
public:
@ -575,11 +585,16 @@ bool PGOUseFunc::readCounters(IndexedInstrProfReader *PGOReader) {
ErrorOr<InstrProfRecord> Result =
PGOReader->getInstrProfRecord(FuncInfo.FuncName, FuncInfo.FunctionHash);
if (std::error_code EC = Result.getError()) {
if (EC == instrprof_error::unknown_function)
if (EC == instrprof_error::unknown_function) {
NumOfPGOMissing++;
else if (EC == instrprof_error::hash_mismatch ||
EC == llvm::instrprof_error::malformed)
if (NoPGOWarnMissing)
return false;
} else if (EC == instrprof_error::hash_mismatch ||
EC == llvm::instrprof_error::malformed) {
NumOfPGOMismatch++;
if (NoPGOWarnMismatch)
return false;
}
std::string Msg = EC.message() + std::string(" ") + F.getName().str();
Ctx.diagnose(