[lld] r315404 - Move a loop invariant outside the loop.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 18:26:22 PDT 2017


Author: ruiu
Date: Tue Oct 10 18:26:22 2017
New Revision: 315404

URL: http://llvm.org/viewvc/llvm-project?rev=315404&view=rev
Log:
Move a loop invariant outside the loop.

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=315404&r1=315403&r2=315404&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Oct 10 18:26:22 2017
@@ -201,13 +201,12 @@ static std::string filename(InputFile *F
 }
 
 bool LinkerScript::shouldKeep(InputSectionBase *S) {
-  for (InputSectionDescription *ID : KeptSections) {
-    std::string Filename = filename(S->File);
+  std::string Filename = filename(S->File);
+  for (InputSectionDescription *ID : KeptSections)
     if (ID->FilePat.match(Filename))
       for (SectionPattern &P : ID->SectionPatterns)
         if (P.SectionPat.match(S->Name))
           return true;
-  }
   return false;
 }
 




More information about the llvm-commits mailing list