[lld] r319930 - Add an early return.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 11:13:23 PST 2017


Author: rafael
Date: Wed Dec  6 11:13:23 2017
New Revision: 319930

URL: http://llvm.org/viewvc/llvm-project?rev=319930&view=rev
Log:
Add an early return.

Total memory allocation when linking clang goes from 281.80MB to
270.96MB.

Modified:
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=319930&r1=319929&r2=319930&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Dec  6 11:13:23 2017
@@ -184,6 +184,8 @@ static std::string getFilename(InputFile
 }
 
 bool LinkerScript::shouldKeep(InputSectionBase *S) {
+  if (KeptSections.empty())
+    return false;
   std::string Filename = getFilename(S->File);
   for (InputSectionDescription *ID : KeptSections)
     if (ID->FilePat.match(Filename))




More information about the llvm-commits mailing list