[PATCH] D48783: [ThinLTO] Use std::map for import lists to get determistic imports files

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 29 13:48:33 PDT 2018


steven_wu added a comment.

In https://reviews.llvm.org/D48783#1148427, @tejohnson wrote:

> In https://reviews.llvm.org/D48783#1148412, @steven_wu wrote:
>
> > Does the iteration order of those map matters other than changing the hash? Will it change symbol resolution or importing different function?
>
>
> No effect on importing/symbol resolution etc. In fact, this is not an input to the compiler at all, it is used by the build system. The change in order will just make it look to the build system like it has changed when it hasn't.


I understand. But if the order is used by the build system, it can also affect the output binary. If the only goal is to keep the thin link function import map constant when the input doesn't change, std::map is fine. Can you add a test case for this?

>> The other option is MapVector, which preserve the insertion order, which might be faster than std::map.
> 
> The trickiness is that currently it may not be inserted in a deterministic order, because we use StringMap elsewhere in the thin link. So std::map is the most straightforward way to get the desired behavior.

This is unfortunate. I can't think of anything can be wrong because of that now but might need to revisit.


Repository:
  rL LLVM

https://reviews.llvm.org/D48783





More information about the llvm-commits mailing list