[llvm] r331591 - [LTO] Handle Task=-1 passed to addSaveTemps

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Sat May 5 07:37:20 PDT 2018


Author: tejohnson
Date: Sat May  5 07:37:20 2018
New Revision: 331591

URL: http://llvm.org/viewvc/llvm-project?rev=331591&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/LTO/LTOBackend.cpp

Modified: llvm/trunk/lib/LTO/LTOBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOBackend.cpp?rev=331591&r1=331590&r2=331591&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOBackend.cpp (original)
+++ llvm/trunk/lib/LTO/LTOBackend.cpp Sat May  5 07:37:20 2018
@@ -76,10 +76,12 @@ Error Config::addSaveTemps(std::string O
       // user hasn't requested using the input module's path, emit to a file
       // named from the provided OutputFileName with the Task ID appended.
       if (M.getModuleIdentifier() == "ld-temp.o" || !UseInputModulePath) {
-        PathPrefix = OutputFileName + utostr(Task);
+        PathPrefix = OutputFileName;
+        if (Task != (unsigned)-1)
+          PathPrefix += utostr(Task) + ".";
       } else
-        PathPrefix = M.getModuleIdentifier();
-      std::string Path = PathPrefix + "." + PathSuffix + ".bc";
+        PathPrefix = M.getModuleIdentifier() + ".";
+      std::string Path = PathPrefix + PathSuffix + ".bc";
       std::error_code EC;
       raw_fd_ostream OS(Path, EC, sys::fs::OpenFlags::F_None);
       // Because -save-temps is a debugging feature, we report the error




More information about the llvm-commits mailing list