Skip to content

Commit 81d9207

Browse files
committedMay 5, 2018
[LTO] Handle Task=-1 passed to addSaveTemps
Summary: This change is necessary for D46464, which will pass -1 as the Task ID for distributed backends, so that the save temps files don't end up with "4294967295" in their path. For distributed back ends, when -1 is passed, don't append any Task ID. An existing test (tools/clang/test/CodeGen/thinlto_backend.ll) will fail without this change after D46464. Reviewers: pcc Subscribers: mehdi_amini, inglorion, llvm-commits Differential Revision: https://reviews.llvm.org/D46488 llvm-svn: 331591
1 parent 7bf8256 commit 81d9207

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

‎llvm/lib/LTO/LTOBackend.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ Error Config::addSaveTemps(std::string OutputFileName,
7676
// user hasn't requested using the input module's path, emit to a file
7777
// named from the provided OutputFileName with the Task ID appended.
7878
if (M.getModuleIdentifier() == "ld-temp.o" || !UseInputModulePath) {
79-
PathPrefix = OutputFileName + utostr(Task);
79+
PathPrefix = OutputFileName;
80+
if (Task != (unsigned)-1)
81+
PathPrefix += utostr(Task) + ".";
8082
} else
81-
PathPrefix = M.getModuleIdentifier();
82-
std::string Path = PathPrefix + "." + PathSuffix + ".bc";
83+
PathPrefix = M.getModuleIdentifier() + ".";
84+
std::string Path = PathPrefix + PathSuffix + ".bc";
8385
std::error_code EC;
8486
raw_fd_ostream OS(Path, EC, sys::fs::OpenFlags::F_None);
8587
// Because -save-temps is a debugging feature, we report the error

0 commit comments

Comments
 (0)
Please sign in to comment.