[all-commits] [llvm/llvm-project] 2859ac: Mix bits in FileID::getHashValue() (#224654)

Akira Hatanaka via All-commits all-commits at lists.llvm.org
Fri Sep 18 08:41:23 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2859acaeca642e0f823c87515ed3c5e23d7f5be4
      https://github.com/llvm/llvm-project/commit/2859acaeca642e0f823c87515ed3c5e23d7f5be4
  Author: Akira Hatanaka <ahatanak at gmail.com>
  Date:   2026-09-18 (Fri, 18 Sep 2026)

  Changed paths:
    M clang/include/clang/Basic/SourceLocation.h

  Log Message:
  -----------
  Mix bits in FileID::getHashValue() (#224654)

FileID's identity hash was fine under DenseMap's old quadratic probing,
but #200595 switched DenseMap to linear probing with backward-shift
deletion. FileID's bucket index under an identity hash is just its low
bits, so two runs of file IDs can map to the same buckets, which can
turn into a long clustered probe chain under linear probing.

Multiply by 37 to spread the low bits, which matches
SourceLocation::getHashValue(). This fixes a 2.6x compile-time
regression observed with -Wdocumentation on an ObjC++ file.

Reapplies #223794, which was reverted because it broke tests in
clang/test/Analysis/html_diagnostics. It is safe to reapply now that
#224510 fixed the underlying issue.

rdar://187026883

Co-authored-by: Fred Riss <friss at apple.com>



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