summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen')
-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