[PATCH] D27147: Put always_inline on adjustExpr

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 26 23:31:09 PST 2016


silvas created this revision.
silvas added reviewers: ruiu, rafael.
silvas added a subscriber: llvm-commits.
silvas set the repository for this revision to rL LLVM.

This function is incredibly hot (it is called unconditionally for every relocation) and so we need everything the compiler can give us for it. It is just a helper anyway.

This change is good for 3-4% speedup on clang-fsds with `ld.lld -O1`.

The compiler that needed this identifies itself as `gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609`

Also, this will allow us in the future to more accurately assess the benefits of PGO for building LLD. If we can get this speedup easily without PGO by just applying an attribute, we don't want this 3-4% to inflate the benefit of PGO when we try PGO.


Repository:
  rL LLVM

https://reviews.llvm.org/D27147

Files:
  ELF/Relocations.cpp


Index: ELF/Relocations.cpp
===================================================================
--- ELF/Relocations.cpp
+++ ELF/Relocations.cpp
@@ -421,10 +421,10 @@
 }
 
 template <class ELFT>
-static RelExpr adjustExpr(const elf::ObjectFile<ELFT> &File, SymbolBody &Body,
-                          bool IsWrite, RelExpr Expr, uint32_t Type,
-                          const uint8_t *Data, InputSectionBase<ELFT> &S,
-                          typename ELFT::uint RelOff) {
+LLVM_ATTRIBUTE_ALWAYS_INLINE static inline RelExpr
+adjustExpr(const elf::ObjectFile<ELFT> &File, SymbolBody &Body, bool IsWrite,
+           RelExpr Expr, uint32_t Type, const uint8_t *Data,
+           InputSectionBase<ELFT> &S, typename ELFT::uint RelOff) {
   bool Preemptible = isPreemptible(Body, Type);
   if (Body.isGnuIFunc()) {
     Expr = toPlt(Expr);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27147.79351.patch
Type: text/x-patch
Size: 839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161127/c5d1849a/attachment.bin>


More information about the llvm-commits mailing list