[all-commits] [llvm/llvm-project] d1e00b: [clang][deps] Only cache files with specific exten...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Mon Mar 20 11:12:58 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d1e00b6f136ec71a4c95a7eb4fd81ec0ab547962
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2023-03-20 (Mon, 20 Mar 2023)

  Changed paths:
    M clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
    M clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
    M clang/unittests/Tooling/DependencyScannerTest.cpp

  Log Message:
  [clang][deps] Only cache files with specific extension

In the scanner's VFS, we cache all files by default and only avoid caching stat failures for certain files. This tanks the performance of scanning with pre-populated module cache. When there is a stale PCM file, it gets cached by the scanner at the start and the rebuilt version never makes it through the VFS again. The TU invocation that rebuilds the PCM only sees the copy in its InMemoryModuleCache, which is invisible to other invocations. This means the PCM gets rebuilt for every TU given to the scanner.

This patch fixes the situation by flipping the default, only caching files that are known to be important, and letting everything else fall through to the underlying VFS.


Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D146328

More information about the All-commits mailing list