[all-commits] [llvm/llvm-project] 9a4a4c: Reapply "[ADT][StringMap] Add ability to precomput...

David Blaikie via All-commits all-commits at lists.llvm.org
Fri Feb 2 12:02:07 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a4a4c3f740226ecfe78db407b5b4333bfe2f8bc
      https://github.com/llvm/llvm-project/commit/9a4a4c3f740226ecfe78db407b5b4333bfe2f8bc
  Author: David Blaikie <dblaikie at gmail.com>
  Date:   2024-02-02 (Fri, 02 Feb 2024)

  Changed paths:
    M llvm/include/llvm/ADT/StringMap.h
    M llvm/lib/Support/StringMap.cpp
    M llvm/unittests/ADT/StringMapTest.cpp

  Log Message:
  -----------
  Reapply "[ADT][StringMap] Add ability to precompute and reuse the string hash"

Reverted due to an internally discovered lld crash, which turned out to
be an existing lld bug that got tickled by this changes. That's
addressed in dee8786f70a3d62b639113343fa36ef55bdbad63 so let's have
another go with this change.

Original commit message:
    Useful for lldb's const string pool, using the hash to determine which
    string map to lock and query/insert.

    Derived from https://reviews.llvm.org/D122974 by Luboš Luňák

This reverts commit f976719fb2cb23364957e5993f7fc3684ee15391.
Effectively reapplying 67c631d283fc96d652304199cd625be426b98f8e.


  Commit: f6b387589d648945372528a4ac77c58f310e5165
      https://github.com/llvm/llvm-project/commit/f6b387589d648945372528a4ac77c58f310e5165
  Author: David Blaikie <dblaikie at gmail.com>
  Date:   2024-02-02 (Fri, 02 Feb 2024)

  Changed paths:
    M lldb/source/Utility/ConstString.cpp
    M llvm/lib/Support/StringMap.cpp

  Log Message:
  -----------
  Reapply "lldb: Cache string hash during ConstString pool queries/insertions"

Reverted due to an internally discovered lld crash due to the underlying
StringMap changes, which turned out to be an existing lld bug that got
tickled by the StringMap changes. That's addressed in
dee8786f70a3d62b639113343fa36ef55bdbad63 so let's have another go with
this change.

Original commit message:
    lldb was rehashing the string 3 times (once to determine which StringMap
    to use, once to query the StringMap, once to insert) on insertion (twice
    on successful lookup).

    This patch allows the lldb to benefit from hash improvements in LLVM
    (from djbHash to xxh3).

    Though further changes would be needed to cache this value to disk - we
    shouldn't rely on the StringMap::hash remaining the same in the
    future/this value should not be serialized to disk. If we want cache
    this value StringMap should take a hashing template parameter to allow
    for a fixed hash to be requested.

This reverts commit 5bc1adff69315dcef670e9fcbe04067b5d5963fb.
Effectively reapplying the original 2e197602305be18b963928e6ae024a004a95af6d.


Compare: https://github.com/llvm/llvm-project/compare/1ac684626377...f6b387589d64


More information about the All-commits mailing list