[PATCH] D54687: [WebAssembly] Make starting indices calcaulation simpler (NFC)
    Heejin Ahn via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Nov 19 00:41:41 PST 2018
    
    
  
aheejin created this revision.
aheejin added a reviewer: sbc100.
Herald added subscribers: llvm-commits, sunfish, jgravelle-google, dschuff.
At the beginning of `assignIndexes() function, when `FunctionIndex` and
`GlobalIndex` variables are created, `InputFunctions` and `InputGlobals`
vectors are guaranteed to be empty, because those vectors are only
populated in `assignIndexes()` function. Current code looks like they
are nonempty, so this patch deletes them for better readability.
Repository:
  rLLD LLVM Linker
https://reviews.llvm.org/D54687
Files:
  wasm/Writer.cpp
Index: wasm/Writer.cpp
===================================================================
--- wasm/Writer.cpp
+++ wasm/Writer.cpp
@@ -891,7 +891,7 @@
 }
 
 void Writer::assignIndexes() {
-  uint32_t FunctionIndex = NumImportedFunctions + InputFunctions.size();
+  uint32_t FunctionIndex = NumImportedFunctions;
   auto AddDefinedFunction = [&](InputFunction *Func) {
     if (!Func->Live)
       return;
@@ -940,7 +940,7 @@
       HandleRelocs(P);
   }
 
-  uint32_t GlobalIndex = NumImportedGlobals + InputGlobals.size();
+  uint32_t GlobalIndex = NumImportedGlobals;
   auto AddDefinedGlobal = [&](InputGlobal *Global) {
     if (Global->Live) {
       LLVM_DEBUG(dbgs() << "AddDefinedGlobal: " << GlobalIndex << "\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54687.174563.patch
Type: text/x-patch
Size: 723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181119/c8be738e/attachment.bin>
    
    
More information about the llvm-commits
mailing list