@@ -812,13 +812,14 @@ std::unique_ptr<lto::LTO> createLTO(
812
812
Conf.PTO .SLPVectorization = Conf.OptLevel > 1 ;
813
813
814
814
if (SaveTemps) {
815
- std::string TempName = (sys::path::filename (ExecutableName) + " -" +
815
+ std::string TempName = (sys::path::filename (ExecutableName) + " -device- " +
816
816
Triple.getTriple () + " -" + Arch)
817
817
.str ();
818
818
Conf.PostInternalizeModuleHook = [=](size_t Task, const Module &M) {
819
- std::string Output = TempName + " ." + std::to_string (Task) + " .bc" ;
819
+ std::string File = !Task ? TempName + " .bc"
820
+ : TempName + " ." + std::to_string (Task) + " .bc" ;
820
821
error_code EC;
821
- raw_fd_ostream LinkedBitcode (Output , EC, sys::fs::OF_None);
822
+ raw_fd_ostream LinkedBitcode (File , EC, sys::fs::OF_None);
822
823
if (EC)
823
824
reportError (errorCodeToError (EC));
824
825
WriteBitcodeToFile (M, LinkedBitcode);
@@ -897,7 +898,7 @@ Error linkBitcodeFiles(SmallVectorImpl<OffloadFile> &InputFiles,
897
898
898
899
// LTO Module hook to output bitcode without running the backend.
899
900
SmallVector<StringRef, 4 > BitcodeOutput;
900
- auto OutputBitcode = [&](size_t Task , const Module &M) {
901
+ auto OutputBitcode = [&](size_t , const Module &M) {
901
902
auto TempFileOrErr = createOutputFile (sys::path::filename (ExecutableName) +
902
903
" -jit-" + Triple.getTriple (),
903
904
" bc" );
@@ -991,9 +992,10 @@ Error linkBitcodeFiles(SmallVectorImpl<OffloadFile> &InputFiles,
991
992
int FD = -1 ;
992
993
auto &TempFile = Files[Task];
993
994
StringRef Extension = (Triple.isNVPTX ()) ? " s" : " o" ;
995
+ std::string TaskStr = Task ? " ." + std::to_string (Task) : " " ;
994
996
auto TempFileOrErr =
995
997
createOutputFile (sys::path::filename (ExecutableName) + " -device-" +
996
- Triple.getTriple () + " . " + std::to_string (Task) ,
998
+ Triple.getTriple () + TaskStr ,
997
999
Extension);
998
1000
if (!TempFileOrErr)
999
1001
reportError (TempFileOrErr.takeError ());
0 commit comments