[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:25:20 PST 2021
jdoerfert added a comment.
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.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94202/new/
https://reviews.llvm.org/D94202
More information about the llvm-commits
mailing list