[Profile] Remove duplicate file locks when enabled continuous mode and online merging.
authorZequan Wu <zequanwu@google.com>
Fri, 7 Jul 2023 21:09:53 +0000 (17:09 -0400)
committerZequan Wu <zequanwu@google.com>
Mon, 10 Jul 2023 15:01:28 +0000 (11:01 -0400)
commit985486dca48bffd9e991d9f5ac32e1d109ae000f
tree9269137b49d6aa61efadfe12152abde1cab6d391
parentc9c32fe069266be5b58a9420bb4b9f76976a8ae9
[Profile] Remove duplicate file locks when enabled continuous mode and online merging.

In `initializeProfileForContinuousMode`, we have already locked the profile file when merging is enabled, so there's no need to lock the same file second time in `openFileForMerging`.

On Linux/Darwin, the locking the same file twice doesn't cause any problem. But on Windows, it causes the problem to hang forever.

With this minor fix, continuous mode seems working with online merging on Windows.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D154748
compiler-rt/lib/profile/InstrProfilingFile.c
compiler-rt/test/profile/ContinuousSyncMode/online-merging-windows.c [new file with mode: 0644]
compiler-rt/test/profile/ContinuousSyncMode/runtime-counter-relocation.c