[PATCH] D27840: COFF: Cache the result of library searches.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 19:56:25 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL289915: COFF: Cache the result of library searches. (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D27840?vs=81709&id=81711#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27840

Files:
  lld/trunk/COFF/Driver.cpp
  lld/trunk/COFF/Driver.h


Index: lld/trunk/COFF/Driver.h
===================================================================
--- lld/trunk/COFF/Driver.h
+++ lld/trunk/COFF/Driver.h
@@ -91,6 +91,7 @@
   // Library search path. The first element is always "" (current directory).
   std::vector<StringRef> SearchPaths;
   std::set<std::string> VisitedFiles;
+  std::set<std::string> VisitedLibs;
 
   SymbolBody *addUndefined(StringRef Sym);
   StringRef mangle(StringRef Sym);
Index: lld/trunk/COFF/Driver.cpp
===================================================================
--- lld/trunk/COFF/Driver.cpp
+++ lld/trunk/COFF/Driver.cpp
@@ -280,11 +280,12 @@
 Optional<StringRef> LinkerDriver::findLib(StringRef Filename) {
   if (Config->NoDefaultLibAll)
     return None;
+  if (!VisitedLibs.insert(Filename.lower()).second)
+    return None;
   StringRef Path = doFindLib(Filename);
   if (Config->NoDefaultLibs.count(Path))
     return None;
-  bool Seen = !VisitedFiles.insert(Path.lower()).second;
-  if (Seen)
+  if (!VisitedFiles.insert(Path.lower()).second)
     return None;
   return Path;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27840.81711.patch
Type: text/x-patch
Size: 1078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161216/f36fab50/attachment.bin>


More information about the llvm-commits mailing list