[PATCH] [opt] Inline a trivial lookup function into the header.

Rui Ueyama ruiu at google.com
Fri Jun 26 19:55:42 PDT 2015


LGTM.


On Fri, Jun 26, 2015 at 7:43 PM, Chandler Carruth <chandlerc at gmail.com>
wrote:

> Hi ruiu,
>
> 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.
>
> http://reviews.llvm.org/D10788
>
> Files:
>   COFF/InputFiles.cpp
>   COFF/InputFiles.h
>
> Index: COFF/InputFiles.cpp
> ===================================================================
> --- COFF/InputFiles.cpp
> +++ COFF/InputFiles.cpp
> @@ -114,10 +114,6 @@
>    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);
> Index: COFF/InputFiles.h
> ===================================================================
> --- COFF/InputFiles.h
> +++ COFF/InputFiles.h
> @@ -101,7 +101,9 @@
>
>    // 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(); }
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150626/1b6c80b1/attachment.html>


More information about the llvm-commits mailing list