[lld] r320070 - Simplify .gnu.hash writing. NFC.
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 11 12:35:29 PST 2017
On Thu, Dec 7, 2017 at 10:51 AM Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: rafael
> Date: Thu Dec 7 10:51:19 2017
> New Revision: 320070
>
> URL: http://llvm.org/viewvc/llvm-project?rev=320070&view=rev
> Log:
> Simplify .gnu.hash writing. NFC.
>
> Modified:
> lld/trunk/ELF/SyntheticSections.cpp
>
> Modified: lld/trunk/ELF/SyntheticSections.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=320070&r1=320069&r2=320070&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/SyntheticSections.cpp (original)
> +++ lld/trunk/ELF/SyntheticSections.cpp Thu Dec 7 10:51:19 2017
> @@ -1750,15 +1750,12 @@ void GnuHashTableSection::writeHashTable
> // Write hash buckets. Hash buckets contain indices in the following
> // hash value table.
> uint32_t *Buckets = reinterpret_cast<uint32_t *>(Buf);
> - auto SymI = Symbols.begin();
> - for (size_t I = 0; I < NBuckets; ++I) {
> - auto NewI = std::find_if(SymI, Symbols.end(), [=](const Entry &Ent) {
> - return Ent.BucketIdx == I;
> - });
> - if (NewI != Symbols.end()) {
> - write32(Buckets + I, NewI->Sym->DynsymIndex);
> - SymI = NewI;
> - }
> + uint32_t OldBucket = -1;
> + for (auto I = Symbols.begin(), E = Symbols.end(); I != E; ++I) {
>
Any particular reason this isn't a range-based for loop?
> + if (I->BucketIdx == OldBucket)
> + continue;
> + OldBucket = I->BucketIdx;
> + write32(Buckets + OldBucket, I->Sym->DynsymIndex);
> }
>
> // Write a hash value table. It represents a sequence of chains that
>
>
> _______________________________________________
> 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/20171211/8d8af804/attachment.html>
More information about the llvm-commits
mailing list