[all-commits] [llvm/llvm-project] f90aa4: [Support] Remove output file checks from `LockFile...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Tue Mar 11 08:51:51 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f90aa418978748c0613036b0285bb80af40570b7
      https://github.com/llvm/llvm-project/commit/f90aa418978748c0613036b0285bb80af40570b7
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2025-03-11 (Tue, 11 Mar 2025)

  Changed paths:
    M clang/lib/Frontend/CompilerInstance.cpp
    M llvm/include/llvm/Support/LockFileManager.h
    M llvm/lib/Support/LockFileManager.cpp

  Log Message:
  -----------
  [Support] Remove output file checks from `LockFileManager` (#130395)

Currently, `LockFileManager` assumes the owner of the lock file creates
an output file. This is problematic for at least three reasons:

1. It is orthogonal to the main purpose of this class - mutual
exclusion. This makes creating an alternative implementation more
complicated than it needs to be.

2. Some clients (like the upstream `AMDGPUSplitModule.cpp` file) assume
the output file is not necessary. The owner of the lock file does not
write the file expected by `LockFileManager` and the processes waiting
for the non-owned lock file to be unlocked therefore assume the owner
has died. This means that the work gets repeated by each waiting
process, serially.

3. The documentation makes it sound like successfully waiting for a
non-owned lock file guarantees the output file to be present on the file
system. Implicitly-built modules rely on this. However, the module file
may disappear between `LockFileManager` performing the check and the
compiler loading the module (for example due to module cache pruning
with short intervals, or intervention from outside of Clang). The
compiler assumes this cannot happen, and fails the build if it does.

This PR solves this situation by removing the check, reflecting that in
the `LockFileManager` documentation, and fixing the time-of-check
time-of-use bug in implicit modules.



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