[all-commits] [llvm/llvm-project] 85ac9a: [clang][deps] Add in-flight query caching to `Depe...

Artem Chikin via All-commits all-commits at lists.llvm.org
Tue Jun 9 08:50:06 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 85ac9a1e00690b1a956aa1ede7fbb11a298b9a78
      https://github.com/llvm/llvm-project/commit/85ac9a1e00690b1a956aa1ede7fbb11a298b9a78
  Author: Artem Chikin <achikin at apple.com>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    M clang/include/clang/DependencyScanning/DependencyScanningFilesystem.h
    M clang/lib/DependencyScanning/DependencyScanningFilesystem.cpp
    M clang/unittests/DependencyScanning/CMakeLists.txt
    M clang/unittests/DependencyScanning/DependencyScanningFilesystemTest.cpp
    M llvm/include/llvm/Support/VirtualFileSystem.h
    M llvm/lib/Support/VirtualFileSystem.cpp
    M llvm/unittests/Support/VirtualFileSystemTest.cpp

  Log Message:
  -----------
  [clang][deps] Add in-flight query caching to `DependencyScanningFilesystemSharedCache` (#199680)

Concurrent dep-scan workers querying the same filename or UID each issue
their own `stat` and `open` against the underlying filesystem; only the
first to finish wins the cache insert, the others' work is wasted.

Add per-key in-flight tracking to `CacheShard`. `InProgressByFilename`
and `InProgressByUID` map each active key to a
`std::shared_ptr<InProgressEntry>` carrying a `std::condition_variable`,
a `Done` predicate, and the produced entry pointer.
`acquireFilenameSlot` / `acquireUIDSlot` collapse three outcomes
(resolved hit, in-progress wait, fresh producer slot) into one critical
section against the shard lock. `fulfilFilenameSlot`,`fulfilUIDSlot`
publish the produced entry, set `Done`, erase the slot, and `notify_all`
waiters outside the lock.

`computeAndStoreResult` now claims the filename slot before `stat` and
the UID slot before `readFile`, so both stat and open redundancy
collapse.



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