diff options
author | Wenlei He <aktoon@gmail.com> | 2019-08-12 17:45:14 +0000 |
---|---|---|
committer | Wenlei He <aktoon@gmail.com> | 2019-08-12 17:45:14 +0000 |
commit | 4b99b58a847c8424d9992a1e92a9f8ae7e4d7b51 (patch) | |
tree | 86dc70b9bdb2657fc4253690e7e351d3f7231b20 /llvm/lib/ProfileData | |
parent | 31ba61bb0d3998bff03dcc30cb24deb3f72ab9ad (diff) | |
download | bcm5719-llvm-4b99b58a847c8424d9992a1e92a9f8ae7e4d7b51.tar.gz bcm5719-llvm-4b99b58a847c8424d9992a1e92a9f8ae7e4d7b51.zip |
[ThinLTO][AutoFDO] Fix memory corruption due to race condition from thin backends
Summary:
This commit fixed a race condition from multi-threaded thinLTO backends that causes non-deterministic memory corruption for a data structure used only by AutoFDO with compact binary profile.
GUIDToFuncNameMap, a static data member of type DenseMap in FunctionSamples is used as a per-module mapping from function name MD5 to name string when input AutoFDO profile is in compact binary format. However with ThinLTO, we can have parallel backends modifying and accessing the class static map concurrently. The fix is to make GUIDToFuncNameMap a member of SampleProfileLoader instead of a file static data.
Reviewers: wmi, davidxl, danielcdh
Subscribers: mehdi_amini, inglorion, hiraditya, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65848
llvm-svn: 368596
Diffstat (limited to 'llvm/lib/ProfileData')
-rw-r--r-- | llvm/lib/ProfileData/SampleProf.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp index e17865cd15a..fcf4d78a080 100644 --- a/llvm/lib/ProfileData/SampleProf.cpp +++ b/llvm/lib/ProfileData/SampleProf.cpp @@ -28,8 +28,6 @@ using namespace sampleprof; namespace llvm { namespace sampleprof { SampleProfileFormat FunctionSamples::Format; -DenseMap<uint64_t, StringRef> FunctionSamples::GUIDToFuncNameMap; -Module *FunctionSamples::CurrentModule; } // namespace sampleprof } // namespace llvm |