[lld] r289270 - COFF: Move a call to toString() out of the hot path.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 12:51:33 PST 2016


Author: pcc
Date: Fri Dec  9 14:51:33 2016
New Revision: 289270

URL: http://llvm.org/viewvc/llvm-project?rev=289270&view=rev
Log:
COFF: Move a call to toString() out of the hot path.

Profiling revealed that we were spending 5% of our time linking
chrome_child.dll just in this call to toString().

Differential Revision: https://reviews.llvm.org/D27628

Modified:
    lld/trunk/COFF/InputFiles.cpp

Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=289270&r1=289269&r2=289270&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Fri Dec  9 14:51:33 2016
@@ -171,8 +171,10 @@ void ObjectFile::initializeSymbols() {
   int32_t LastSectionNumber = 0;
   for (uint32_t I = 0; I < NumSymbols; ++I) {
     // Get a COFFSymbolRef object.
-    COFFSymbolRef Sym =
-        check(COFFObj->getSymbol(I), "broken object file: " + toString(this));
+    ErrorOr<COFFSymbolRef> SymOrErr = COFFObj->getSymbol(I);
+    if (!SymOrErr)
+      fatal(SymOrErr.getError(), "broken object file: " + toString(this));
+    COFFSymbolRef Sym = *SymOrErr;
 
     const void *AuxP = nullptr;
     if (Sym.getNumberOfAuxSymbols())




More information about the llvm-commits mailing list