[lld] r240873 - [opt] Inline a trivial lookup function into the header.

Chandler Carruth chandlerc at gmail.com
Fri Jun 26 20:40:10 PDT 2015


Author: chandlerc
Date: Fri Jun 26 22:40:10 2015
New Revision: 240873

URL: http://llvm.org/viewvc/llvm-project?rev=240873&view=rev
Log:
[opt] Inline a trivial lookup function into the header.

This function is actually *very* hot. It is hard to see currently
because the call graph is very recursive, but I'm working to remove that
and when I do this function becomes significantly higher on the profile
(up to 5%!) and so worth avoiding the call overhead.

No specific perf gain I can measure yet (below the noise), but likely to
have more impact as we stop cluttering the call graph.

Differential Revision: http://reviews.llvm.org/D10788

Modified:
    lld/trunk/COFF/InputFiles.cpp
    lld/trunk/COFF/InputFiles.h

Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=240873&r1=240872&r2=240873&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Fri Jun 26 22:40:10 2015
@@ -114,10 +114,6 @@ std::error_code ObjectFile::parse() {
   return initializeSymbols();
 }
 
-SymbolBody *ObjectFile::getSymbolBody(uint32_t SymbolIndex) {
-  return SparseSymbolBodies[SymbolIndex]->getReplacement();
-}
-
 std::error_code ObjectFile::initializeChunks() {
   uint32_t NumSections = COFFObj->getNumberOfSections();
   Chunks.reserve(NumSections);

Modified: lld/trunk/COFF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.h?rev=240873&r1=240872&r2=240873&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.h (original)
+++ lld/trunk/COFF/InputFiles.h Fri Jun 26 22:40:10 2015
@@ -101,7 +101,9 @@ public:
 
   // Returns a SymbolBody object for the SymbolIndex'th symbol in the
   // underlying object file.
-  SymbolBody *getSymbolBody(uint32_t SymbolIndex);
+  SymbolBody *getSymbolBody(uint32_t SymbolIndex) {
+    return SparseSymbolBodies[SymbolIndex]->getReplacement();
+  }
 
   // Returns the underying COFF file.
   COFFObjectFile *getCOFFObj() { return COFFObj.get(); }





More information about the llvm-commits mailing list