summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-08-01 22:50:16 +0000
committerJustin Bogner <mail@justinbogner.com>2014-08-01 22:50:16 +0000
commit9c6818ef00da5c59c0762fea85bd936e0fc31327 (patch)
treec988497e08b952a52a934ab5c1892ba9f4ed2d27 /clang/lib
parent821d7471f91858ce91de86df940cedfab4166543 (diff)
downloadbcm5719-llvm-9c6818ef00da5c59c0762fea85bd936e0fc31327.tar.gz
bcm5719-llvm-9c6818ef00da5c59c0762fea85bd936e0fc31327.zip
InstrProf: Update for LLVM API change
We've added support for a multiple functions with the same name in LLVM's profile data, so the lookup returning the function hash it found doesn't make sense anymore. Update to pass in the hash we expect. This also adds a test that the version 1 format is still readable, since the new API is expected to handle that. llvm-svn: 214586
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index b233e3c7d75..4def789132a 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -917,13 +917,15 @@ void CodeGenPGO::loadRegionCounts(llvm::IndexedInstrProfReader *PGOReader,
bool IsInMainFile) {
CGM.getPGOStats().addVisited(IsInMainFile);
RegionCounts.reset(new std::vector<uint64_t>);
- uint64_t Hash;
- if (PGOReader->getFunctionCounts(getFuncName(), Hash, *RegionCounts)) {
- CGM.getPGOStats().addMissing(IsInMainFile);
- RegionCounts.reset();
- } else if (Hash != FunctionHash ||
- RegionCounts->size() != NumRegionCounters) {
- CGM.getPGOStats().addMismatched(IsInMainFile);
+ if (std::error_code EC = PGOReader->getFunctionCounts(
+ getFuncName(), FunctionHash, *RegionCounts)) {
+ if (EC == llvm::instrprof_error::unknown_function)
+ CGM.getPGOStats().addMissing(IsInMainFile);
+ else if (EC == llvm::instrprof_error::hash_mismatch)
+ CGM.getPGOStats().addMismatched(IsInMainFile);
+ else if (EC == llvm::instrprof_error::malformed)
+ // TODO: Consider a more specific warning for this case.
+ CGM.getPGOStats().addMismatched(IsInMainFile);
RegionCounts.reset();
}
}
OpenPOWER on IntegriCloud