[all-commits] [llvm/llvm-project] 432bf4: [profile] Fix file contention causing dropped coun...

tstellar via All-commits all-commits at lists.llvm.org
Thu Dec 5 09:02:29 PST 2019


  Branch: refs/heads/release/9.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 432bf48c08da748e2542cf40e3ab9aee53a744b0
      https://github.com/llvm/llvm-project/commit/432bf48c08da748e2542cf40e3ab9aee53a744b0
  Author: Hans Wennborg <hans at chromium.org>
  Date:   2019-12-05 (Thu, 05 Dec 2019)

  Changed paths:
    M compiler-rt/lib/profile/InstrProfilingUtil.c
    A compiler-rt/test/profile/Windows/Inputs/instrprof-multiprocess.c
    A compiler-rt/test/profile/Windows/instrprof-multiprocess.test
    A compiler-rt/test/profile/Windows/lit.local.cfg.py

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

See PR43425:
https://bugs.llvm.org/show_bug.cgi?id=43425

When writing profile data on Windows we were opening profile file with
exclusive read/write access.

In case we are trying to write to the file from multiple processes
simultaneously, subsequent calls to CreateFileA would return
INVALID_HANDLE_VALUE.

To fix this, I changed to open without exclusive access and then take a
lock.

Patch by Michael Holman!

Differential revision: https://reviews.llvm.org/D70330

(cherry picked from commit 900d8a9a3b4efeefddd310e92219741d98e7270b)




More information about the All-commits mailing list