summaryrefslogtreecommitdiffstats
path: root/clang/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
commite2ef2a09ef265fe854f160d127537dc243d1ffc4 (patch)
tree4b2e76c2775910359017a1e038e77899fb134f08 /clang/lib/CodeGen/CodeGenPGO.cpp
parent3f0c79ce8df08f2cb56f48a3dfe3051305ade54d (diff)
downloadbcm5719-llvm-e2ef2a09ef265fe854f160d127537dc243d1ffc4.tar.gz
bcm5719-llvm-e2ef2a09ef265fe854f160d127537dc243d1ffc4.zip
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. llvm-svn: 206322
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index 55a09e8db52..c451bef57c5 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/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() {
OpenPOWER on IntegriCloud