From 49ee76d082e8ce581e408d49ba9d3f8b1d18b7bd Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Fri, 18 Dec 2015 22:22:12 +0000 Subject: [PATCH] [PGO] Simplify computehash interface (NFC) llvm-svn: 256047 --- llvm/include/llvm/ProfileData/InstrProf.h | 4 ++++ llvm/lib/ProfileData/InstrProf.cpp | 3 +-- llvm/lib/ProfileData/InstrProfWriter.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h index 6e813e24eb8a..365656bb9d2c 100644 --- a/llvm/include/llvm/ProfileData/InstrProf.h +++ b/llvm/include/llvm/ProfileData/InstrProf.h @@ -575,6 +575,10 @@ const uint64_t Magic = 0x8169666f72706cff; // "\xfflprofi\x81" const uint64_t Version = INSTR_PROF_INDEX_VERSION; const HashT HashType = HashT::MD5; +static inline uint64_t ComputeHash(StringRef K) { + return ComputeHash(HashType, K); +} + // This structure defines the file header of the LLVM profile // data file in indexed-format. struct Header { diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp index 00c9057c8b45..10ba68c41d15 100644 --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -201,8 +201,7 @@ void getValueForSiteInstrProf(const void *R, InstrProfValueData *Dst, uint64_t stringToHash(uint32_t ValueKind, uint64_t Value) { switch (ValueKind) { case IPVK_IndirectCallTarget: - return IndexedInstrProf::ComputeHash(IndexedInstrProf::HashType, - (const char *)Value); + return IndexedInstrProf::ComputeHash((const char *)Value); break; default: llvm_unreachable("value kind not handled !"); diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp index 478cf80db7a0..2f4ef0829061 100644 --- a/llvm/lib/ProfileData/InstrProfWriter.cpp +++ b/llvm/lib/ProfileData/InstrProfWriter.cpp @@ -35,7 +35,7 @@ public: typedef uint64_t offset_type; static hash_value_type ComputeHash(key_type_ref K) { - return IndexedInstrProf::ComputeHash(IndexedInstrProf::HashType, K); + return IndexedInstrProf::ComputeHash(K); } static std::pair