<div dir="ltr">Cool. I will investigate that possibility.<div><br></div><div>David</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 21, 2016 at 11:49 AM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Jan 21, 2016, at 11:46 AM, Xinliang David Li <<a href="mailto:davidxl@google.com">davidxl@google.com</a>> wrote:<br>
><br>
> On Thu, Jan 21, 2016 at 11:41 AM, Mehdi Amini <<a href="mailto:mehdi.amini@apple.com">mehdi.amini@apple.com</a>> wrote:<br>
>><br>
>> On Jan 21, 2016, at 11:32 AM, Xinliang David Li via llvm-commits<br>
>> <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
>><br>
>><br>
>><br>
>> On Thu, Jan 21, 2016 at 11:26 AM, Vedant Kumar via llvm-commits<br>
>> <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
>>><br>
>>> I haven't seen a failure yet, this is a latent issue.<br>
>>><br>
>>> AFAICT mutable static variables are generally avoided in llvm. We use<br>
>>> llvm::ManagedStatic with atomics or locking if absolutely necessary.<br>
>>><br>
>>> Could you move this field into InstrProfWriter and InstrProfRecordTraits?<br>
>><br>
>><br>
>> The problem is that the trait's EmitData method (which references the<br>
>> variable) is a static method as well ..<br>
>><br>
>><br>
>> Naive comment/question: if it is just a debug/testing flag, why not making<br>
>> it a cl::opt one?<br>
><br>
> yes -- the interface is used by unittest. Not sure if cl::opt can work<br>
> in this case?<br>
<br>
</span>The unit tests would have to call ParseCommandLineOptions, there is a precedent for that, see  unittests/Analysis/MixedTBAATest.cpp<br>
(I’m not saying this is *the* thing to do in your case, just pointing the option).<br>
<br>
—<br>
<span class="HOEnZb"><font color="#888888">Mehdi<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
><br>
> David<br>
><br>
>><br>
>> —<br>
>> Mehdi<br>
>><br>
>><br>
>><br>
>> David<br>
>><br>
>>><br>
>>><br>
>>> vedant<br>
>>><br>
>>>> On Jan 21, 2016, at 9:58 AM, Xinliang David Li <<a href="mailto:davidxl@google.com">davidxl@google.com</a>><br>
>>>> wrote:<br>
>>>><br>
>>>> The setter call is invoked only in a unittest. Can you send me the<br>
>>>> failure report? (currently InstrProfRecordTraits has no members and is<br>
>>>> stateless).<br>
>>>><br>
>>>> thanks,<br>
>>>><br>
>>>> David<br>
>>>><br>
>>>> On Thu, Jan 21, 2016 at 1:17 AM, Vedant Kumar <<a href="mailto:vsk@apple.com">vsk@apple.com</a>> wrote:<br>
>>>>> Hi David,<br>
>>>>><br>
>>>>>> namespace {<br>
>>>>>> +static support::endianness ValueProfDataEndianness = support::little;<br>
>>>>>> +// Internal interface for testing purpose only.<br>
>>>>>> +void InstrProfWriter::setValueProfDataEndianness(<br>
>>>>>> +    support::endianness Endianness) {<br>
>>>>>> +  ValueProfDataEndianness = Endianness;<br>
>>>>>> +}<br>
>>>>><br>
>>>>><br>
>>>>> Please remove this static variable. It breaks clients who use llvm in a<br>
>>>>> multi-threaded environment.<br>
>>>>><br>
>>>>> thanks<br>
>>>>> vedant<br>
>>>>><br>
>>><br>
>>> _______________________________________________<br>
>>> llvm-commits mailing list<br>
>>> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br>
</div></div></blockquote></div><br></div>