[PATCH] D38266: Parallelize string merging.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 05:10:05 PDT 2017


grimar added inline comments.


================
Comment at: lld/ELF/SyntheticSections.cpp:2241
+        if (Sec->Pieces[I].Live && Sec->Hashes[I] % NumShards == ShardId)
+          Sec->Pieces[I].OutputOff = Shards[ShardId].add(Sec->getData(I));
+  });
----------------
ruiu wrote:
> grimar wrote:
> > Will it be better to calculate Begin and End instead of iterating over all pieces and using constructions like `Sec->Hashes[I] % NumShards == ShardId` ?
> > Something like:
> > 
> > ```
> > size_t TaskSize = Sec->Pieces.size() / NumShards;
> > size_t I = TaskSize * ShardId;
> > size_t E = (ShardId == NumShards - 1) ? Sec->Pieces.size() : I + TaskSize;
> > ```
> That won't work because it doesn't guarantee to produce a minimum table.
What I want to say is that spec says: "SHF_MERGE is an optional flag indicating a possible optimization. The link-editor is allowed to perform the optimization, or to ignore the optimization."

`MergeNoTailSection` is used for -O1. So for full optimization it is not used and that means users agree to have larger output size than is possible in theory, but have faster link time.
In that sence it can be acceptable not to guatantee a minimum table as it anyways not minimum possible one.

if such change does not noticably reduces the link time, it make no sence though.


https://reviews.llvm.org/D38266





More information about the llvm-commits mailing list