[lld] r248106 - COFF: Fix race condition.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 08:20:03 PDT 2015
On Sun, Sep 20, 2015 at 6:42 PM, Rui Ueyama <ruiu at google.com> wrote:
> We can, but I think we don't have to, because I didn't see any measurable
> difference between this code and the old racy one.
>
... in terms of speed.
> 2015/09/20 18:32 "Sean Silva" <chisophugis at gmail.com>:
>
> It seems unfortunate for us to need any synchronization at all just to
>> generate a unique ID. Can we just have a bunch of counters, one per thread,
>> then initialize them to `ThreadIndex << 50` or something? (make sure they
>> are each on their own cache line)
>>
>> -- Sean Silva
>>
>> On Sat, Sep 19, 2015 at 6:44 PM, Rui Ueyama via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>> Author: ruiu
>>> Date: Sat Sep 19 20:44:44 2015
>>> New Revision: 248106
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=248106&view=rev
>>> Log:
>>> COFF: Fix race condition.
>>>
>>> NextID is updated inside parallel_for_each, so it needs mutual exclusion.
>>>
>>> Modified:
>>> lld/trunk/COFF/ICF.cpp
>>>
>>> Modified: lld/trunk/COFF/ICF.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/ICF.cpp?rev=248106&r1=248105&r2=248106&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/COFF/ICF.cpp (original)
>>> +++ lld/trunk/COFF/ICF.cpp Sat Sep 19 20:44:44 2015
>>> @@ -73,7 +73,7 @@ private:
>>> bool forEachGroup(std::vector<SectionChunk *> &Chunks, Comparator Eq);
>>> bool partition(ChunkIterator Begin, ChunkIterator End, Comparator Eq);
>>>
>>> - uint64_t NextID = 1;
>>> + std::atomic<uint64_t> NextID = { 1 };
>>> };
>>>
>>> // Entry point to ICF.
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150921/a21436b0/attachment.html>
More information about the llvm-commits
mailing list