summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenPGO.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-04-15 21:22:35 +0000
committerJustin Bogner <mail@justinbogner.com>2014-04-15 21:22:35 +0000
commit859d2b24895e5bfaa52005a48a36236024175bfb (patch)
tree79554223b7d00d1a476b438c5958069506a8fbd2 /lib/CodeGen/CodeGenPGO.cpp
parent206fe8c782ce766fccf35c5769c33df331fe9e6c (diff)
downloadclang-859d2b24895e5bfaa52005a48a36236024175bfb.tar.gz
clang-859d2b24895e5bfaa52005a48a36236024175bfb.tar.bz2
clang-859d2b24895e5bfaa52005a48a36236024175bfb.tar.xz
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
Diffstat (limited to 'lib/CodeGen/CodeGenPGO.cpp')
-rw-r--r--lib/CodeGen/CodeGenPGO.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenPGO.cpp b/lib/CodeGen/CodeGenPGO.cpp
index 55a09e8db5..c451bef57c 100644
--- a/lib/CodeGen/CodeGenPGO.cpp
+++ b/lib/CodeGen/CodeGenPGO.cpp
@@ -908,11 +908,17 @@ void CodeGenPGO::emitCounterIncrement(CGBuilderTy &Builder, unsigned Counter) {
}
void CodeGenPGO::loadRegionCounts(PGOProfileData *PGOData) {
+ CGM.getPGOStats().Visited++;
RegionCounts.reset(new std::vector<uint64_t>);
uint64_t Hash;
- if (PGOData->getFunctionCounts(getFuncName(), Hash, *RegionCounts) ||
- Hash != FunctionHash || RegionCounts->size() != NumRegionCounters)
+ if (PGOData->getFunctionCounts(getFuncName(), Hash, *RegionCounts)) {
+ CGM.getPGOStats().Missing++;
RegionCounts.reset();
+ } else if (Hash != FunctionHash ||
+ RegionCounts->size() != NumRegionCounters) {
+ CGM.getPGOStats().Mismatched++;
+ RegionCounts.reset();
+ }
}
void CodeGenPGO::destroyRegionCounters() {