[PATCH] D12867: ELF2: Simplify by removing temporary variables

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


ruiu created this revision.
ruiu added a reviewer: rafael.
ruiu added a subscriber: llvm-commits.

No functionality change intended.

http://reviews.llvm.org/D12867

Files:
  ELF/Writer.cpp

Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -237,19 +237,14 @@
     *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; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12867.34758.patch
Type: text/x-patch
Size: 722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150914/fc993c6c/attachment.bin>


More information about the llvm-commits mailing list