[lld] r321317 - Define isUndefWeak inline.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 14:26:45 PST 2017


Author: rafael
Date: Thu Dec 21 14:26:44 2017
New Revision: 321317

URL: http://llvm.org/viewvc/llvm-project?rev=321317&view=rev
Log:
Define isUndefWeak inline.

This small function was showing up in the profile. Defining it inline
gives about 0.3% speedup.

Modified:
    lld/trunk/ELF/Symbols.cpp
    lld/trunk/ELF/Symbols.h

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=321317&r1=321316&r2=321317&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Thu Dec 21 14:26:44 2017
@@ -116,12 +116,6 @@ static uint64_t getSymVA(const Symbol &S
   llvm_unreachable("invalid symbol kind");
 }
 
-// Returns true if this is a weak undefined symbol.
-bool Symbol::isUndefWeak() const {
-  // See comment on Lazy in Symbols.h for the details.
-  return isWeak() && (isUndefined() || isLazy());
-}
-
 uint64_t Symbol::getVA(int64_t Addend) const {
   uint64_t OutVA = getSymVA(*this, Addend);
   return OutVA + Addend;

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=321317&r1=321316&r2=321317&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Thu Dec 21 14:26:44 2017
@@ -102,7 +102,10 @@ public:
 
   // True is this is an undefined weak symbol. This only works once
   // all input files have been added.
-  bool isUndefWeak() const;
+  bool isUndefWeak() const {
+    // See comment on Lazy the details.
+    return isWeak() && (isUndefined() || isLazy());
+  }
 
   StringRef getName() const { return Name; }
   uint8_t getVisibility() const { return StOther & 0x3; }




More information about the llvm-commits mailing list