Author: bogner
Date: Fri Aug 1 17:50:16 2014
New Revision: 214586
URL: http://llvm.org/viewvc/llvm-project?rev=214586&view=rev
Log:
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.
Added:
cfe/trunk/test/Profile/Inputs/c-general.profdata.v1
Modified:
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/test/Profile/c-general.c
Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=214586&r1=214585&r2=214586&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Fri Aug 1 17:50:16 2014
@@ -917,13 +917,15 @@ void CodeGenPGO::loadRegionCounts(llvm::
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();
}
}
Added: cfe/trunk/test/Profile/Inputs/c-general.profdata.v1
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/Inputs/c-general.profdata.v1?rev=214586&view=auto
==============================================================================
Binary files cfe/trunk/test/Profile/Inputs/c-general.profdata.v1 (added) and
cfe/trunk/test/Profile/Inputs/c-general.profdata.v1 Fri Aug 1 17:50:16 2014
differ
Modified: cfe/trunk/test/Profile/c-general.c
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/c-general.c?rev=214586&r1=214585&r2=214586&view=diff
==============================================================================
--- cfe/trunk/test/Profile/c-general.c (original)
+++ cfe/trunk/test/Profile/c-general.c Fri Aug 1 17:50:16 2014
@@ -5,6 +5,9 @@
// RUN: llvm-profdata merge %S/Inputs/c-general.proftext -o %t.profdata
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-general.c
%s -o - -emit-llvm -fprofile-instr-use=%t.profdata | FileCheck
-check-prefix=PGOUSE %s
+// Also check compatibility with older profiles.
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-general.c
%s -o - -emit-llvm -fprofile-instr-use=%S/Inputs/c-general.profdata.v1 |
FileCheck -check-prefix=PGOUSE %s
+
// PGOGEN: @[[SLC:__llvm_profile_counters_simple_loops]] = hidden global [4 x
i64] zeroinitializer
// PGOGEN: @[[IFC:__llvm_profile_counters_conditionals]] = hidden global [11 x
i64] zeroinitializer
// PGOGEN: @[[EEC:__llvm_profile_counters_early_exits]] = hidden global [9 x
i64] zeroinitializer
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits