[lld] r247652 - ELF2: Simplify by removing temporary variables.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 18:03:58 PDT 2015


Author: ruiu
Date: Mon Sep 14 20:03:58 2015
New Revision: 247652

URL: http://llvm.org/viewvc/llvm-project?rev=247652&view=rev
Log:
ELF2: Simplify by removing temporary variables.

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=247652&r1=247651&r2=247652&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Sep 14 20:03:58 2015
@@ -237,19 +237,14 @@ public:
     *P++ = NumSymbols; // nbucket
     *P++ = NumSymbols; // nchain
 
-    std::vector<uint32_t> Buckets(NumSymbols);
-    std::vector<uint32_t> Chains(NumSymbols);
+    Elf_Word *Buckets = P;
+    Elf_Word *Chains = P + NumSymbols;
 
     for (unsigned I = 1; I < NumSymbols; ++I) {
       uint32_t Hash = Hashes[I - 1] % NumSymbols;
       Chains[I] = Buckets[Hash];
       Buckets[Hash] = I;
     }
-
-    for (uint32_t V : Buckets)
-      *P++ = V;
-    for (uint32_t V : Chains)
-      *P++ = V;
   }
 
   SymbolTableSection<ELFT> &getDynSymSec() { return DynSymSec; }




More information about the llvm-commits mailing list