1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

[PGO] Fix computation of function Hash

And bump its version number accordingly.

This is a patched recommit of 7c298c104bfe725d4315926a656263e8a5ac3054

Previous hash implementation was incorrectly passing an uint64_t, that got converted
to an uint8_t, to finalize the hash computation. This led to different functions
having the same hash if they only differ by the remaining statements, which is
incorrect.

Added a new test case that trivially tests that a small function change is
reflected in the hash value.

Not that as this patch fixes the hash computation, it would invalidate all hashes
computed before that patch applies, this is why we bumped the version number.

Update profile data hash entries due to hash function update, except for binary
version, in which case we keep the buggy behavior for backward compatibility.

Differential Revision: https://reviews.llvm.org/D79961
This commit is contained in:
serge-sans-paille 2020-05-25 20:44:35 +02:00
parent 8c2042119c
commit e92c41e0e9
2 changed files with 4 additions and 1 deletions

View File

@ -979,6 +979,9 @@ enum ProfVersion {
Version4 = 4, Version4 = 4,
// In this version, the frontend PGO stable hash algorithm defaults to V2. // In this version, the frontend PGO stable hash algorithm defaults to V2.
Version5 = 5, Version5 = 5,
// In this version, the frontend PGO stable hash algorithm got fixed and
// may produce hashes different from Version5.
Version6 = 6,
// The current version is 5. // The current version is 5.
CurrentVersion = INSTR_PROF_INDEX_VERSION CurrentVersion = INSTR_PROF_INDEX_VERSION
}; };

View File

@ -657,7 +657,7 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
/* Raw profile format version (start from 1). */ /* Raw profile format version (start from 1). */
#define INSTR_PROF_RAW_VERSION 5 #define INSTR_PROF_RAW_VERSION 5
/* Indexed profile format version (start from 1). */ /* Indexed profile format version (start from 1). */
#define INSTR_PROF_INDEX_VERSION 5 #define INSTR_PROF_INDEX_VERSION 6
/* Coverage mapping format version (start from 0). */ /* Coverage mapping format version (start from 0). */
#define INSTR_PROF_COVMAP_VERSION 3 #define INSTR_PROF_COVMAP_VERSION 3