[lld] r249987 - ELF2: Use SmallPtrSet instead of unordered_set.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 11 11:13:52 PDT 2015


Thanks!
On Oct 11, 2015 1:46 PM, "Rui Ueyama via llvm-commits" <
llvm-commits at lists.llvm.org> wrote:

> Author: ruiu
> Date: Sun Oct 11 12:44:22 2015
> New Revision: 249987
>
> URL: http://llvm.org/viewvc/llvm-project?rev=249987&view=rev
> Log:
> ELF2: Use SmallPtrSet instead of unordered_set.
>
> This patch addresses Rafael's review comments to r249955.
>
> Modified:
>     lld/trunk/ELF/Writer.cpp
>
> Modified: lld/trunk/ELF/Writer.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=249987&r1=249986&r2=249987&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/Writer.cpp (original)
> +++ lld/trunk/ELF/Writer.cpp Sun Oct 11 12:44:22 2015
> @@ -13,8 +13,8 @@
>  #include "SymbolTable.h"
>  #include "Target.h"
>
> +#include "llvm/ADT/SmallPtrSet.h"
>  #include "llvm/Support/FileOutputBuffer.h"
> -#include <unordered_set>
>
>  using namespace llvm;
>  using namespace llvm::ELF;
> @@ -473,6 +473,9 @@ template <class ELFT> void Writer<ELFT>:
>        ++NumPhdrs;
>      }
>    }
> +
> +  // Reserve space needed for the program header so that the array
> +  // will never be resized.
>    Phdrs.reserve(NumPhdrs);
>
>    // The first Phdr entry is PT_PHDR which describes the program header
> itself.
> @@ -494,7 +497,7 @@ template <class ELFT> void Writer<ELFT>:
>    Elf_Phdr *FileHeader = &Phdrs.back();
>    phdrSet(FileHeader, PT_LOAD, PF_R, 0, getVAStart(),
> Target->getPageSize());
>
> -  std::unordered_set<Elf_Phdr *> Closed;
> +  SmallPtrSet<Elf_Phdr *, 8> Closed;
>    for (OutputSectionBase<ELFT::Is64Bits> *Sec : OutputSections) {
>      if (Sec->getSize()) {
>        uintX_t Flags = toPhdrFlags(Sec->getFlags());
>
>
> _______________________________________________
> 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/20151011/48090fa1/attachment.html>


More information about the llvm-commits mailing list