[PATCH] D44146: [WebAssembly] Remove duplicated line of code and unreachable check. NFC

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 05:59:15 PST 2018


ncw created this revision.
ncw added a reviewer: sbc100.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff, jfb.

Note - the line of code removed is duplicated at the end of createCtorFunction. It *used* to do something different to the line at the top, but now after some refactoring the line has in fact become useless.

Note 2 - the liveness check came to my eye because there's a clear typo in the line ("return" instead of "continue"). I tried to write a test to exercise the bug, but found that in fact it's not possible, since relocatable can't be used with GC, so it's not possible to have non-Live symbols in the symtab.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D44146

Files:
  wasm/Writer.cpp


Index: wasm/Writer.cpp
===================================================================
--- wasm/Writer.cpp
+++ wasm/Writer.cpp
@@ -693,8 +693,7 @@
     for (Symbol *Sym : File->getSymbols()) {
       if (Sym->getFile() != File)
         continue;
-      if (!Sym->isLive())
-        return;
+      assert(Sym->isLive());
       Sym->setOutputSymbolIndex(SymbolIndex++);
       SymtabEntries.emplace_back(Sym);
     }
@@ -849,7 +848,6 @@
 // in input object.
 void Writer::createCtorFunction() {
   uint32_t FunctionIndex = NumImportedFunctions + InputFunctions.size();
-  WasmSym::CallCtors->setOutputIndex(FunctionIndex);
 
   // First write the body's contents to a string.
   std::string BodyContent;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44146.137175.patch
Type: text/x-patch
Size: 708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180306/bf0a7444/attachment.bin>


More information about the llvm-commits mailing list