[lld] r226284 - [PECOFF] Improve parallelism.

Rui Ueyama ruiu at google.com
Fri Jan 16 07:58:36 PST 2015


Author: ruiu
Date: Fri Jan 16 09:58:36 2015
New Revision: 226284

URL: http://llvm.org/viewvc/llvm-project?rev=226284&view=rev
Log:
[PECOFF] Improve parallelism.

Modified:
    lld/trunk/lib/Driver/WinLinkDriver.cpp
    lld/trunk/test/pecoff/unknown-drectve.test

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=226284&r1=226283&r2=226284&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Fri Jan 16 09:58:36 2015
@@ -837,7 +837,7 @@ static bool maybeRunLibCommand(int argc,
 
 /// \brief Parse the input file to lld::File.
 void addFiles(PECOFFLinkingContext &ctx, StringRef path, raw_ostream &diag,
-	      std::vector<std::unique_ptr<File>> &files) {
+              std::vector<std::unique_ptr<File>> &files) {
   for (std::unique_ptr<File> &file : loadFile(ctx, path, false)) {
     if (ctx.logInputFiles())
       diag << file->path() << "\n";
@@ -1393,7 +1393,7 @@ bool WinLinkDriver::parse(int argc, cons
   if (!ctx.getNoDefaultLibAll())
     for (const StringRef path : defaultLibs)
       if (!ctx.hasNoDefaultLib(path))
-	addFiles(ctx, getLibraryPath(ctx, path.lower()), diag, libraries);
+        addFiles(ctx, getLibraryPath(ctx, path.lower()), diag, libraries);
 
   if (files.empty() && !isReadingDirectiveSection) {
     diag << "No input files\n";
@@ -1410,9 +1410,10 @@ bool WinLinkDriver::parse(int argc, cons
 
   // Add the input files to the input graph.
   for (std::unique_ptr<File> &file : files) {
-    if (isReadingDirectiveSection)
-      if (file->parse())
-        return false;
+    if (isReadingDirectiveSection) {
+      File *f = file.get();
+      ctx.getTaskGroup().spawn([f] { f->parse(); });
+    }
     ctx.getResolvableSymsFile()->add(file.get());
     ctx.getNodes().push_back(llvm::make_unique<FileNode>(std::move(file)));
   }
@@ -1426,9 +1427,10 @@ bool WinLinkDriver::parse(int argc, cons
   // Add the library files to the library group.
   for (std::unique_ptr<File> &file : libraries) {
     if (!hasLibrary(ctx, file.get())) {
-      if (isReadingDirectiveSection)
-        if (file->parse())
-          return false;
+      if (isReadingDirectiveSection) {
+        File *f = file.get();
+        ctx.getTaskGroup().spawn([f] { f->parse(); });
+      }
       ctx.getResolvableSymsFile()->add(file.get());
       ctx.addLibraryFile(llvm::make_unique<FileNode>(std::move(file)));
     }

Modified: lld/trunk/test/pecoff/unknown-drectve.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/unknown-drectve.test?rev=226284&r1=226283&r2=226284&view=diff
==============================================================================
--- lld/trunk/test/pecoff/unknown-drectve.test (original)
+++ lld/trunk/test/pecoff/unknown-drectve.test Fri Jan 16 09:58:36 2015
@@ -3,4 +3,4 @@
 # RUN: not lld -flavor link /out:%t.exe -- %t.obj >& %t.log
 # RUN: FileCheck -check-prefix=ERROR %s < %t.log
 
-ERROR: Failed to parse '/nosuchoption:foobar'
+ERROR: Cannot open /nosuchoption:foobar





More information about the llvm-commits mailing list