]> granicus.if.org Git - clang/commit
InstrProf: Calculate a better function hash
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 16 Apr 2014 16:03:27 +0000 (16:03 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 16 Apr 2014 16:03:27 +0000 (16:03 +0000)
commit98461062a9b329e6d46e5016fd13e4e65edf8c84
tree45b88d775b311239e9698932e5caa369e0bf23c2
parent6eeb8eb072504da7149331c6d666a4a2462567c9
InstrProf: Calculate a better function hash

The function hash should change when control flow changes.  This patch
hashes the type of each AST node that affects counters, rather than just
counting how many there are.  These types are combined into a small
enumerator that currently has 16 values.

The new hash algorithm packs the enums for consecutively visited types
into a `uint64_t`.  In order to save space for new types, the types are
assumed to be 6-bit values (instead of 4-bit).  In order to minimize
overhead for functions with little control flow, the `uint64_t` is used
directly as a hash if it never fills up; if it does, it's passed through
an MD5 context.

<rdar://problem/16435801>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206397 91177308-0d34-0410-b5e6-96231b3b80d8
15 files changed:
lib/CodeGen/CodeGenPGO.cpp
test/Profile/Inputs/c-attributes.profdata
test/Profile/Inputs/c-captured.profdata
test/Profile/Inputs/c-counter-overflows.profdata
test/Profile/Inputs/c-general.profdata
test/Profile/Inputs/c-outdated-data.profdata
test/Profile/Inputs/c-unprofiled-blocks.profdata
test/Profile/Inputs/cxx-class.profdata
test/Profile/Inputs/cxx-lambda.profdata
test/Profile/Inputs/cxx-templates.profdata
test/Profile/Inputs/cxx-throws.profdata
test/Profile/Inputs/objc-general.profdata
test/Profile/c-linkage-available_externally.c
test/Profile/c-linkage.c
test/Profile/cxx-linkage.cpp