[llvm] llvm-profgen: Fix race condition (PR #83489)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 10:10:45 PDT 2024


MatzeB wrote:

> @MatzeB , why do we need to create a uniq temp perf-script for each llvm-profgen read?

Without this change, when you have two `llvm-profgen` instances running on the same input at the same time they will overwrite each others intermediate files and break (i.e. first caller starts conversion; at the same time 2nd caller starts conversion writing to the same file; then if first caller starts reading it may read a half-finished conversion from the 2nd caller).
The previous code also had downsides like needing the directory containing the profile file to be writable which isn't necessarily true or expected by the user.

https://github.com/llvm/llvm-project/pull/83489


More information about the llvm-commits mailing list