[PATCH] D43709: [WebAssembly] Remove redundant local variables.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 16:35:25 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL326280: [WebAssembly] Remove redundant local variables. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43709?vs=135756&id=136185#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43709

Files:
  lld/trunk/wasm/OutputSections.cpp


Index: lld/trunk/wasm/OutputSections.cpp
===================================================================
--- lld/trunk/wasm/OutputSections.cpp
+++ lld/trunk/wasm/OutputSections.cpp
@@ -107,15 +107,12 @@
   memcpy(Buf, Header.data(), Header.size());
   Buf += Header.size();
 
-  uint8_t *ContentsStart = Buf;
-
   // Write code section headers
   memcpy(Buf, CodeSectionHeader.data(), CodeSectionHeader.size());
-  Buf += CodeSectionHeader.size();
 
   // Write code section bodies
-  parallelForEach(Functions, [ContentsStart](const InputChunk *Chunk) {
-    Chunk->writeTo(ContentsStart);
+  parallelForEach(Functions, [&](const InputChunk *Chunk) {
+    Chunk->writeTo(Buf);
   });
 }
 
@@ -168,19 +165,17 @@
   memcpy(Buf, Header.data(), Header.size());
   Buf += Header.size();
 
-  uint8_t *ContentsStart = Buf;
-
   // Write data section headers
   memcpy(Buf, DataSectionHeader.data(), DataSectionHeader.size());
 
-  parallelForEach(Segments, [ContentsStart](const OutputSegment *Segment) {
+  parallelForEach(Segments, [&](const OutputSegment *Segment) {
     // Write data segment header
-    uint8_t *SegStart = ContentsStart + Segment->getSectionOffset();
+    uint8_t *SegStart = Buf + Segment->getSectionOffset();
     memcpy(SegStart, Segment->Header.data(), Segment->Header.size());
 
     // Write segment data payload
     for (const InputChunk *Chunk : Segment->InputSegments)
-      Chunk->writeTo(ContentsStart);
+      Chunk->writeTo(Buf);
   });
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43709.136185.patch
Type: text/x-patch
Size: 1479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180228/f8892e07/attachment.bin>


More information about the llvm-commits mailing list