[all-commits] [llvm/llvm-project] dc7db8: TableGen: Emit perfect hash function for runtime l...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Sun Aug 3 23:18:10 PDT 2025


  Branch: refs/heads/users/arsenm/tablegen/emit-perfect-hash-table-runtime-libcalls
  Home:   https://github.com/llvm/llvm-project
  Commit: dc7db82c9e8e7684fdce7ffc00156a8e5454850c
      https://github.com/llvm/llvm-project/commit/dc7db82c9e8e7684fdce7ffc00156a8e5454850c
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-08-04 (Mon, 04 Aug 2025)

  Changed paths:
    M llvm/benchmarks/CMakeLists.txt
    A llvm/benchmarks/RuntimeLibcalls.cpp
    M llvm/include/llvm/IR/RuntimeLibcalls.h
    M llvm/lib/IR/RuntimeLibcalls.cpp
    M llvm/lib/Object/IRSymtab.cpp
    M llvm/test/TableGen/RuntimeLibcallEmitter.td
    M llvm/unittests/IR/CMakeLists.txt
    A llvm/unittests/IR/RuntimeLibcallsTest.cpp
    M llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp

  Log Message:
  -----------
  TableGen: Emit perfect hash function for runtime libcalls

a96121089b9c94e08c6632f91f2dffc73c0ffa28 reverted a change
to use a binary search on the string name table because it
was too slow. This replaces it with a static string hash
table based on the known set of libcall names. Microbenchmarking
shows this is similarly fast to using DenseMap. It's possibly
slightly slower than using StringSet, though these aren't an
exact comparison. This also saves on the one time use construction
of the map, so it could be better in practice.

This search isn't simple set check, since it does find the
range of possible matches with the same name. There's also
an additional check for whether the current target supports
the name. The runtime constructed set doesn't require this,
since it only adds the symbols live for the target.

Followed algorithm from this post
http://0x80.pl/notesen/2023-04-30-lookup-in-strings.html

I'm also thinking the 2 special case global symbols should
just be added to RuntimeLibcalls. There are also other global
references emitted in the backend that aren't tracked; we probably
should just use this as a centralized database for all compiler
selected symbols.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list