[PATCH] D70330: [profile] Fix file contention causing dropped counts on Windows under -fprofile-generate

Michael Holman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 11:26:59 PST 2019


Holman marked an inline comment as done.
Holman added a comment.

In D70330#1749324 <https://reviews.llvm.org/D70330#1749324>, @hans wrote:

> Please reference PR43425 in the patch description. I don't know if the reproducer from there can be used as a test case, but at least it should be possible to use to check this works manually.


I'm not sure how amenable that is to being a test case, but I did manually verify my fix with it. There actually is a test already but it only runs on Linux. I'm trying to see if I can pull it out to run on Windows as well.



================
Comment at: compiler-rt/lib/profile/InstrProfilingUtil.c:222
 
+  if (lprofLockFd(fd) != 0)
+    PROF_WARN("Data may be corrupted during profile merging : %s\n",
----------------
hans wrote:
> Does lprofLockFd work on Windows? It looks like it just calls flock() but I didn't know that's a Windows thing?
It's not a Windows thing, but there is a shim for it in compiler-rt/lib/profile/WindowsMMap.c which calls LockFileEx under the hood.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70330/new/

https://reviews.llvm.org/D70330





More information about the llvm-commits mailing list