[PATCH] D94202: Preserve the lexical order of global variables during llvm-link merge

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 2 09:54:18 PST 2021


jdoerfert added a comment.

In D94202#2597735 <https://reviews.llvm.org/D94202#2597735>, @jinlin wrote:

> In D94202#2597644 <https://reviews.llvm.org/D94202#2597644>, @jdoerfert wrote:
>
>> In D94202#2597614 <https://reviews.llvm.org/D94202#2597614>, @jinlin wrote:
>>
>>> In D94202#2597598 <https://reviews.llvm.org/D94202#2597598>, @jdoerfert wrote:
>>>
>>>> This looks brittle and wrong to fiddle with the initializers of the variables and doing some complex logic.
>>>> You want to preserve the order, ok, couldn't we just sort the globals in the resulting module according to the order in the source(s)?
>>>
>>> Sorry I have sent the wrong patch to the review and it causes many lit cases fails.
>>>
>>> The order of the globals is determined when the globals are generated. If you want to sort the order, you have to regenerate the globals and replace the old ones with new ones.
>>
>> Aren't the globals stored in a list that allows to change their order? It has a remove and insert, that should be sufficient.
>
> You can remove, replace or append. However, you cannot insert. Please correct me if I am wrong.

As far as I can tell the list has insert with a position.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94202/new/

https://reviews.llvm.org/D94202



More information about the llvm-commits mailing list