From 859d2b24895e5bfaa52005a48a36236024175bfb Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 15 Apr 2014 21:22:35 +0000 Subject: CodeGen: Emit warnings for out of date profile data during PGO This adds a warning that triggers when profile data doesn't match for the source that's being compiled with -fprofile-instr-use=. This fires only once per translation unit, as warning on every mismatched function would be quite noisy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206322 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index 0d13bdcc2f..f6614dd44b 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -220,6 +220,15 @@ struct ARCEntrypoints { llvm::Constant *clang_arc_use; }; +/// This class records statistics on instrumentation based profiling. +struct InstrProfStats { + InstrProfStats() : Visited(0), Missing(0), Mismatched(0) {} + bool isOutOfDate() { return Missing || Mismatched; } + uint32_t Visited; + uint32_t Missing; + uint32_t Mismatched; +}; + /// CodeGenModule - This class organizes the cross-function state that is used /// while generating LLVM code. class CodeGenModule : public CodeGenTypeCache { @@ -258,6 +267,7 @@ class CodeGenModule : public CodeGenTypeCache { llvm::MDNode *NoObjCARCExceptionsMetadata; RREntrypoints *RRData; PGOProfileData *PGOData; + InstrProfStats PGOStats; // WeakRefReferences - A set of references that have only been seen via // a weakref so far. This is used to remove the weak of the reference if we @@ -483,6 +493,10 @@ public: return *RRData; } + InstrProfStats &getPGOStats() { + return PGOStats; + } + PGOProfileData *getPGOData() const { return PGOData; } -- cgit v1.2.3