[PATCH] D38431: [ProfileData] Fix data racing in merging indexed profiles

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 14:56:35 PDT 2017


xur created this revision.

There are some data races when merging multiple indexed profiles with multiple threads. 
(1) the static variable RecordIndex in index profile reader needs to be thread_local. 
Otherwise, multiple function entries with different hashes in the profile lead to segfault.
(2) thread partition in loading the profile does not seem to be right: we are submitting  a separated thread for each input and multiple threads can access the same WriteContext. 
This patch fixes the above issues.


https://reviews.llvm.org/D38431

Files:
  lib/ProfileData/InstrProfReader.cpp
  test/tools/llvm-profdata/Inputs/multiple-profdata-merge.proftext
  test/tools/llvm-profdata/multiple-profdata-merge.test
  tools/llvm-profdata/llvm-profdata.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38431.117228.patch
Type: text/x-patch
Size: 3338 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170929/f3fc810e/attachment.bin>


More information about the llvm-commits mailing list