[lld] r317910 - Use DenseMap instead of std::map in fixupExports

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 00:27:50 PST 2017


DenseMap's iteration order can be different depending on host's word size
because I believe the default hash function produces different hash values
on 32-bit than 64-bit. Does lld still produce the same output on both 32/64
hosts?

On Sat, Nov 11, 2017 at 4:12 AM, Reid Kleckner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rnk
> Date: Fri Nov 10 11:12:01 2017
> New Revision: 317910
>
> URL: http://llvm.org/viewvc/llvm-project?rev=317910&view=rev
> Log:
> Use DenseMap instead of std::map in fixupExports
>
> Some DLLs have many exports, and this data structure shows up in the
> profile of linking content.dll.
>
> Modified:
>     lld/trunk/COFF/DriverUtils.cpp
>
> Modified: lld/trunk/COFF/DriverUtils.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/
> DriverUtils.cpp?rev=317910&r1=317909&r2=317910&view=diff
> ============================================================
> ==================
> --- lld/trunk/COFF/DriverUtils.cpp (original)
> +++ lld/trunk/COFF/DriverUtils.cpp Fri Nov 10 11:12:01 2017
> @@ -594,7 +594,7 @@ void fixupExports() {
>    }
>
>    // Uniquefy by name.
> -  std::map<StringRef, Export *> Map;
> +  DenseMap<StringRef, Export *> Map(Config->Exports.size());
>    std::vector<Export> V;
>    for (Export &E : Config->Exports) {
>      auto Pair = Map.insert(std::make_pair(E.ExportName, &E));
>
>
> _______________________________________________
> 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/20171114/8a37bfd1/attachment.html>


More information about the llvm-commits mailing list