[PATCH] D49764: Simplify ObjFile::createDefined().

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 24 15:28:12 PDT 2018


ruiu created this revision.
ruiu added a reviewer: pcc.

Since readAssociativeDefinition is called again for every symbol,
we don't need to do anything on the first iteration.


https://reviews.llvm.org/D49764

Files:
  lld/COFF/InputFiles.cpp


Index: lld/COFF/InputFiles.cpp
===================================================================
--- lld/COFF/InputFiles.cpp
+++ lld/COFF/InputFiles.cpp
@@ -207,12 +207,6 @@
     COFFSymbolRef Sym, const coff_aux_section_definition *Def) {
   SectionChunk *Parent = SparseChunks[Def->getNumber(Sym.isBigObj())];
 
-  // If the parent is pending, it probably means that its section definition
-  // appears after us in the symbol table. Leave the associated section as
-  // pending; we will handle it during the second pass in initializeSymbols().
-  if (Parent == PendingComdat)
-    return;
-
   // Check whether the parent is prevailing. If it is, so are we, and we read
   // the section; otherwise mark it as discarded.
   int32_t SectionNumber = Sym.getSectionNumber();
@@ -366,20 +360,15 @@
     return Leader;
   }
 
-  // Read associative section definitions and prepare to handle the comdat
-  // leader symbol by setting the section's ComdatDefs pointer if we encounter a
-  // non-associative comdat.
+  // Prepare to handle the comdat leader symbol by setting the section's
+  // ComdatDefs pointer if we encounter a non-associative comdat.
   if (SparseChunks[SectionNumber] == PendingComdat) {
-    if (auto *Def = Sym.getSectionDefinition()) {
-      if (Def->Selection == IMAGE_COMDAT_SELECT_ASSOCIATIVE)
-        readAssociativeDefinition(Sym, Def);
-      else
+    if (auto *Def = Sym.getSectionDefinition())
+      if (Def->Selection != IMAGE_COMDAT_SELECT_ASSOCIATIVE)
         ComdatDefs[SectionNumber] = Def;
-    }
+    return None;
   }
 
-  if (SparseChunks[SectionNumber] == PendingComdat)
-    return None;
   return createRegular(Sym);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49764.157143.patch
Type: text/x-patch
Size: 1673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180724/01508e59/attachment.bin>


More information about the llvm-commits mailing list