@@ -236,9 +236,8 @@ void printCommands(ArrayRef<StringRef> CmdArgs) {
236236 if (CmdArgs.empty ())
237237 return ;
238238
239- llvm::errs () << " \" " << CmdArgs.front () << " \" " ;
240- llvm::errs () << llvm::join (std::next (CmdArgs.begin ()), CmdArgs.end (), " " )
241- << " \n " ;
239+ errs () << " \" " << CmdArgs.front () << " \" " ;
240+ errs () << join (std::next (CmdArgs.begin ()), CmdArgs.end (), " " ) << " \n " ;
242241}
243242
244243// / A minimum symbol interface that provides the necessary information to
@@ -329,12 +328,12 @@ Expected<std::unique_ptr<lto::LTO>> createLTO(const ArgList &Args) {
329328 lto::ThinBackend Backend;
330329 unsigned Jobs = 0 ;
331330 if (auto *Arg = Args.getLastArg (OPT_jobs))
332- if (!llvm:: to_integer (Arg->getValue (), Jobs) || Jobs == 0 )
331+ if (!to_integer (Arg->getValue (), Jobs) || Jobs == 0 )
333332 reportError (createStringError (" %s: expected a positive integer, got '%s'" ,
334333 Arg->getSpelling ().data (),
335334 Arg->getValue ()));
336- Backend = lto::createInProcessThinBackend (
337- llvm:: heavyweight_hardware_concurrency (Jobs));
335+ Backend =
336+ lto::createInProcessThinBackend ( heavyweight_hardware_concurrency (Jobs));
338337
339338 Conf.CPU = Args.getLastArgValue (OPT_arch);
340339 Conf.Options = codegen::InitTargetOptionsFromCodeGenFlags (Triple);
@@ -378,7 +377,7 @@ Expected<std::unique_ptr<lto::LTO>> createLTO(const ArgList &Args) {
378377
379378 unsigned Partitions = 1 ;
380379 if (auto *Arg = Args.getLastArg (OPT_lto_partitions))
381- if (!llvm:: to_integer (Arg->getValue (), Partitions) || Partitions == 0 )
380+ if (!to_integer (Arg->getValue (), Partitions) || Partitions == 0 )
382381 reportError (createStringError (" %s: expected a positive integer, got '%s'" ,
383382 Arg->getSpelling ().data (),
384383 Arg->getValue ()));
@@ -510,7 +509,7 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
510509 InputFiles.emplace_back (std::move (*BufferOrErr), /* IsLazy=*/ false );
511510 break ;
512511 case file_magic::archive: {
513- Expected<std::unique_ptr<llvm:: object::Archive>> LibFile =
512+ Expected<std::unique_ptr<object::Archive>> LibFile =
514513 object::Archive::create (Buffer);
515514 if (!LibFile)
516515 return LibFile.takeError ();
@@ -563,7 +562,7 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
563562 for (auto &Input : LinkerInput)
564563 if (identify_magic (Input->getBuffer ()) == file_magic::bitcode)
565564 BitcodeFiles.emplace_back (std::move (Input));
566- llvm:: erase_if (LinkerInput, [](const auto &F) { return !F; });
565+ erase_if (LinkerInput, [](const auto &F) { return !F; });
567566
568567 // Run the LTO pipeline on the extracted inputs.
569568 SmallVector<StringRef> Files;
@@ -574,7 +573,7 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
574573 lto::LTO <OBackend = **LTOBackendOrErr;
575574 for (auto &BitcodeFile : BitcodeFiles) {
576575 Expected<std::unique_ptr<lto::InputFile>> BitcodeFileOrErr =
577- llvm:: lto::InputFile::create (*BitcodeFile);
576+ lto::InputFile::create (*BitcodeFile);
578577 if (!BitcodeFileOrErr)
579578 return BitcodeFileOrErr.takeError ();
580579
@@ -638,7 +637,7 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
638637 if (std::error_code EC = sys::fs::openFileForWrite (TempFile, FD))
639638 reportError (errorCodeToError (EC));
640639 return std::make_unique<CachedFileStream>(
641- std::make_unique<llvm:: raw_fd_ostream>(FD, true ));
640+ std::make_unique<raw_fd_ostream>(FD, true ));
642641 };
643642
644643 if (Error Err = LTOBackend.run (AddStream))
@@ -655,11 +654,11 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
655654 }
656655 }
657656
658- // Create a link for each file to a new file ending in `.cubin`. The 'nvlink'
657+ // Create a copy for each file to a new file ending in `.cubin`. The 'nvlink'
659658 // linker requires all NVPTX inputs to have this extension for some reason.
660- // Windows cannot create symbolic links so we just copy the whole file.
659+ // We don't use a symbolic link because it's not supported on Windows and some
660+ // of this input files could be extracted from an archive.
661661 for (auto &Input : LinkerInput) {
662- #ifdef _WIN32
663662 auto TempFileOrErr = createTempFile (
664663 Args, sys::path::stem (Input->getBufferIdentifier ()), " cubin" );
665664 if (!TempFileOrErr)
@@ -669,22 +668,10 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
669668 if (!OutputOrErr)
670669 return OutputOrErr.takeError ();
671670 std::unique_ptr<FileOutputBuffer> Output = std::move (*OutputOrErr);
672- llvm:: copy (Input->getBuffer (), Output->getBufferStart ());
671+ copy (Input->getBuffer (), Output->getBufferStart ());
673672 if (Error E = Output->commit ())
674673 return E;
675674 Files.emplace_back (Args.MakeArgString (*TempFileOrErr));
676- #else
677- SmallString<128 > TempFile;
678- if (std::error_code EC = sys::fs::getPotentiallyUniqueTempFileName (
679- sys::path::stem (Input->getBufferIdentifier ()), " cubin" , TempFile))
680- reportError (createFileError (TempFile, EC));
681- if (std::error_code EC =
682- sys::fs::create_link (Input->getBufferIdentifier (), TempFile)) {
683- reportError (createFileError (TempFile, EC));
684- }
685- Files.emplace_back (Args.MakeArgString (TempFile));
686- TempFiles.emplace_back (std::move (TempFile));
687- #endif
688675 }
689676
690677 return Files;
@@ -718,8 +705,8 @@ Error runNVLink(ArrayRef<StringRef> Files, const ArgList &Args) {
718705 Arg->render (Args, NewLinkerArgs);
719706 }
720707
721- llvm:: transform (Files, std::back_inserter (NewLinkerArgs),
722- [&](StringRef Arg) { return Args.MakeArgString (Arg); });
708+ transform (Files, std::back_inserter (NewLinkerArgs),
709+ [&](StringRef Arg) { return Args.MakeArgString (Arg); });
723710
724711 SmallVector<StringRef> LinkerArgs ({*NVLinkPath});
725712 if (!Args.hasArg (OPT_o))
0 commit comments