[llvm] r225186 - SymbolRewriter: use iplist::splice

David Blaikie dblaikie at gmail.com
Mon Jan 5 23:54:42 PST 2015


On Mon, Jan 5, 2015 at 6:56 PM, Saleem Abdulrasool <compnerd at compnerd.org>
wrote:

> On Mon, Jan 5, 2015 at 10:27 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>>
>>
>> On Mon, Jan 5, 2015 at 9:56 AM, Saleem Abdulrasool <compnerd at compnerd.org
>> > wrote:
>>
>>> Author: compnerd
>>> Date: Mon Jan  5 11:56:32 2015
>>> New Revision: 225186
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=225186&view=rev
>>> Log:
>>> SymbolRewriter: use iplist::splice
>>>
>>> The swap implementation for iplist is currently unsupported.  Simply
>>> splice the
>>> old list into place, which achieves the same purpose.  This is needed in
>>> order
>>> to thread the -frewrite-map-file frontend option correctly.  NFC.
>>>
>>> Modified:
>>>     llvm/trunk/lib/Transforms/Utils/SymbolRewriter.cpp
>>>
>>> Modified: llvm/trunk/lib/Transforms/Utils/SymbolRewriter.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SymbolRewriter.cpp?rev=225186&r1=225185&r2=225186&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/Transforms/Utils/SymbolRewriter.cpp (original)
>>> +++ llvm/trunk/lib/Transforms/Utils/SymbolRewriter.cpp Mon Jan  5
>>> 11:56:32 2015
>>> @@ -494,7 +494,7 @@ RewriteSymbols::RewriteSymbols() : Modul
>>>
>>>  RewriteSymbols::RewriteSymbols(SymbolRewriter::RewriteDescriptorList
>>> &DL)
>>>      : ModulePass(ID) {
>>> -  std::swap(Descriptors, DL);
>>> +  Descriptors.splice(Descriptors.begin(), DL);
>>>
>>
>> Could we just implement swap with splice, or does that not work?
>>
>
> I can get away with it here, since I don't really care about the swap,
> merely that the contents of the provided list are moved over (cheaply).
> Splice moves the range from one list to the other.  I suppose that we could
> use that and a temporary to do the swap.
>

Well, perhaps more importantly, we could implement the move ctor in terms
of splice. (then the default std::swap will do fine, using move
ctor/assignment operators)


>
>
>>  }
>>>
>>>  bool RewriteSymbols::runOnModule(Module &M) {
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>
>>
>
>
> --
> Saleem Abdulrasool
> compnerd (at) compnerd (dot) org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150105/705a5b91/attachment.html>


More information about the llvm-commits mailing list