[all-commits] [llvm/llvm-project] de02a7: [PGO] Fix computation of function Hash

serge-sans-paille via All-commits all-commits at lists.llvm.org
Wed May 27 00:15:47 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: de02a75e398415bad4df27b4547c25b896c8bf3b
      https://github.com/llvm/llvm-project/commit/de02a75e398415bad4df27b4547c25b896c8bf3b
  Author: serge-sans-paille <sguelton at redhat.com>
  Date:   2020-05-27 (Wed, 27 May 2020)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/CodeGen/CodeGenPGO.cpp
    M clang/test/Profile/Inputs/c-counter-overflows.proftext
    A clang/test/Profile/Inputs/c-general.profdata.v5
    M clang/test/Profile/Inputs/c-general.proftext
    M clang/test/Profile/Inputs/c-unprofiled-blocks.proftext
    M clang/test/Profile/Inputs/cxx-rangefor.proftext
    M clang/test/Profile/Inputs/cxx-throws.proftext
    M clang/test/Profile/Inputs/misexpect-switch-default.proftext
    M clang/test/Profile/Inputs/misexpect-switch-nonconst.proftext
    M clang/test/Profile/Inputs/misexpect-switch.proftext
    A clang/test/Profile/c-collision.c
    M clang/test/Profile/c-general.c
    M llvm/include/llvm/ProfileData/InstrProf.h
    M llvm/include/llvm/ProfileData/InstrProfData.inc

  Log Message:
  -----------
  [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




More information about the All-commits mailing list