@@ -236,9 +236,8 @@ void printCommands(ArrayRef<StringRef> CmdArgs) {
236
236
if (CmdArgs.empty ())
237
237
return ;
238
238
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 " ;
242
241
}
243
242
244
243
// / A minimum symbol interface that provides the necessary information to
@@ -329,12 +328,12 @@ Expected<std::unique_ptr<lto::LTO>> createLTO(const ArgList &Args) {
329
328
lto::ThinBackend Backend;
330
329
unsigned Jobs = 0 ;
331
330
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 )
333
332
reportError (createStringError (" %s: expected a positive integer, got '%s'" ,
334
333
Arg->getSpelling ().data (),
335
334
Arg->getValue ()));
336
- Backend = lto::createInProcessThinBackend (
337
- llvm:: heavyweight_hardware_concurrency (Jobs));
335
+ Backend =
336
+ lto::createInProcessThinBackend ( heavyweight_hardware_concurrency (Jobs));
338
337
339
338
Conf.CPU = Args.getLastArgValue (OPT_arch);
340
339
Conf.Options = codegen::InitTargetOptionsFromCodeGenFlags (Triple);
@@ -378,7 +377,7 @@ Expected<std::unique_ptr<lto::LTO>> createLTO(const ArgList &Args) {
378
377
379
378
unsigned Partitions = 1 ;
380
379
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 )
382
381
reportError (createStringError (" %s: expected a positive integer, got '%s'" ,
383
382
Arg->getSpelling ().data (),
384
383
Arg->getValue ()));
@@ -510,7 +509,7 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
510
509
InputFiles.emplace_back (std::move (*BufferOrErr), /* IsLazy=*/ false );
511
510
break ;
512
511
case file_magic::archive: {
513
- Expected<std::unique_ptr<llvm:: object::Archive>> LibFile =
512
+ Expected<std::unique_ptr<object::Archive>> LibFile =
514
513
object::Archive::create (Buffer);
515
514
if (!LibFile)
516
515
return LibFile.takeError ();
@@ -563,7 +562,7 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
563
562
for (auto &Input : LinkerInput)
564
563
if (identify_magic (Input->getBuffer ()) == file_magic::bitcode)
565
564
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; });
567
566
568
567
// Run the LTO pipeline on the extracted inputs.
569
568
SmallVector<StringRef> Files;
@@ -574,7 +573,7 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
574
573
lto::LTO <OBackend = **LTOBackendOrErr;
575
574
for (auto &BitcodeFile : BitcodeFiles) {
576
575
Expected<std::unique_ptr<lto::InputFile>> BitcodeFileOrErr =
577
- llvm:: lto::InputFile::create (*BitcodeFile);
576
+ lto::InputFile::create (*BitcodeFile);
578
577
if (!BitcodeFileOrErr)
579
578
return BitcodeFileOrErr.takeError ();
580
579
@@ -638,7 +637,7 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
638
637
if (std::error_code EC = sys::fs::openFileForWrite (TempFile, FD))
639
638
reportError (errorCodeToError (EC));
640
639
return std::make_unique<CachedFileStream>(
641
- std::make_unique<llvm:: raw_fd_ostream>(FD, true ));
640
+ std::make_unique<raw_fd_ostream>(FD, true ));
642
641
};
643
642
644
643
if (Error Err = LTOBackend.run (AddStream))
@@ -655,11 +654,11 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
655
654
}
656
655
}
657
656
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'
659
658
// 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.
661
661
for (auto &Input : LinkerInput) {
662
- #ifdef _WIN32
663
662
auto TempFileOrErr = createTempFile (
664
663
Args, sys::path::stem (Input->getBufferIdentifier ()), " cubin" );
665
664
if (!TempFileOrErr)
@@ -669,22 +668,10 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
669
668
if (!OutputOrErr)
670
669
return OutputOrErr.takeError ();
671
670
std::unique_ptr<FileOutputBuffer> Output = std::move (*OutputOrErr);
672
- llvm:: copy (Input->getBuffer (), Output->getBufferStart ());
671
+ copy (Input->getBuffer (), Output->getBufferStart ());
673
672
if (Error E = Output->commit ())
674
673
return E;
675
674
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
688
675
}
689
676
690
677
return Files;
@@ -718,8 +705,8 @@ Error runNVLink(ArrayRef<StringRef> Files, const ArgList &Args) {
718
705
Arg->render (Args, NewLinkerArgs);
719
706
}
720
707
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); });
723
710
724
711
SmallVector<StringRef> LinkerArgs ({*NVLinkPath});
725
712
if (!Args.hasArg (OPT_o))
0 commit comments