[PATCH] D136651: [Clang] Give Clang the ability to use a shared stat cache

Frederic Riss via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 24 17:21:13 PDT 2022


friss created this revision.
friss added reviewers: jansvoboda11, bnbarham, arphaman.
Herald added a subscriber: hiraditya.
Herald added a project: All.
friss requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

  Every Clang instance uses an internal FileSystemStatCache to avoid
  stating the same content multiple times. However, different instances
  of Clang will contend for filesystem access for their initial stats
  during HeaderSearch or module validation.
  
  On some workloads, the time spent in the kernel in these concurrent
  stat calls has been measured to be over 20% of the overall compilation
  time. This is extremly wassteful when most of the stat calls target
  mostly immutable content like a SDK.
  
  This commit introduces a new tool `clang-stat-cache` able to generate
  an OnDiskHashmap containing the stat data for a given filesystem
  hierarchy.
  
  The driver part of this has been modeled after -ivfsoverlay given
  the similarities with what it influences. It introduces a new
  -ivfsstatcache driver option to instruct Clang to use a stat cache
  generated by `clang-stat-cache`. These stat caches are inserted at
  the bottom of the VFS stack (right above the real filesystem).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136651

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/include/clang/Driver/Options.td
  clang/include/clang/Lex/HeaderSearchOptions.h
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/vfsstatcache.c
  clang/test/clang-stat-cache/cache-effects.c
  clang/test/clang-stat-cache/errors.test
  clang/tools/CMakeLists.txt
  clang/tools/clang-stat-cache/CMakeLists.txt
  clang/tools/clang-stat-cache/clang-stat-cache.cpp
  llvm/include/llvm/Support/VirtualFileSystem.h
  llvm/lib/Support/VirtualFileSystem.cpp
  llvm/unittests/Support/VirtualFileSystemTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136651.470328.patch
Type: text/x-patch
Size: 51097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221025/f8ef7c91/attachment-0001.bin>


More information about the cfe-commits mailing list