]> granicus.if.org Git - llvm/commitdiff
[ProfData] Make the method threadsafe
authorXinliang David Li <davidxl@google.com>
Tue, 27 Jun 2017 17:21:51 +0000 (17:21 +0000)
committerXinliang David Li <davidxl@google.com>
Tue, 27 Jun 2017 17:21:51 +0000 (17:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306428 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ProfileData/InstrProf.cpp

index 005061c4f0680c7f6fef35d87319f47d6c33fb76..1dc596fa7ed61ba2976c8b194277443e89f0585e 100644 (file)
@@ -642,8 +642,9 @@ static ValueProfRecordClosure InstrProfRecordClosure = {
 
 // Wrapper implementation using the closure mechanism.
 uint32_t ValueProfData::getSize(const InstrProfRecord &Record) {
-  InstrProfRecordClosure.Record = &Record;
-  return getValueProfDataSize(&InstrProfRecordClosure);
+  auto Closure = InstrProfRecordClosure;
+  Closure.Record = &Record;
+  return getValueProfDataSize(&Closure);
 }
 
 // Wrapper implementation using the closure mechanism.