[PATCH] D29160: gold-plugin: Simplify naming of object files created with save-temps or obj-path.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 25 17:00:52 PST 2017
pcc created this revision.
Now we never append a number to the file name for task ID 0.
https://reviews.llvm.org/D29160
Files:
llvm/test/tools/gold/X86/parallel.ll
llvm/tools/gold/gold-plugin.cpp
Index: llvm/tools/gold/gold-plugin.cpp
===================================================================
--- llvm/tools/gold/gold-plugin.cpp
+++ llvm/tools/gold/gold-plugin.cpp
@@ -106,7 +106,6 @@
static StringMap<ResolutionInfo> ResInfo;
static std::vector<std::string> Cleanup;
static llvm::TargetOptions TargetOpts;
-static size_t MaxTasks;
namespace options {
enum OutputType {
@@ -637,16 +636,16 @@
/// indicating whether a temp file should be generated, and an optional task id.
/// The new filename generated is returned in \p NewFilename.
static void getOutputFileName(SmallString<128> InFilename, bool TempOutFile,
- SmallString<128> &NewFilename, int TaskID = -1) {
+ SmallString<128> &NewFilename, int TaskID) {
if (TempOutFile) {
std::error_code EC =
sys::fs::createTemporaryFile("lto-llvm", "o", NewFilename);
if (EC)
message(LDPL_FATAL, "Could not create temporary file: %s",
EC.message().c_str());
} else {
NewFilename = InFilename;
- if (TaskID >= 0)
+ if (TaskID > 0)
NewFilename += utostr(TaskID);
}
}
@@ -813,15 +812,15 @@
Filename = output_name + ".o";
bool SaveTemps = !Filename.empty();
- MaxTasks = Lto->getMaxTasks();
+ size_t MaxTasks = Lto->getMaxTasks();
std::vector<uintptr_t> IsTemporary(MaxTasks);
std::vector<SmallString<128>> Filenames(MaxTasks);
auto AddStream =
[&](size_t Task) -> std::unique_ptr<lto::NativeObjectStream> {
IsTemporary[Task] = !SaveTemps;
getOutputFileName(Filename, /*TempOutFile=*/!SaveTemps, Filenames[Task],
- MaxTasks > 1 ? Task : -1);
+ Task);
int FD;
std::error_code EC =
sys::fs::openFileForWrite(Filenames[Task], FD, sys::fs::F_None);
Index: llvm/test/tools/gold/X86/parallel.ll
===================================================================
--- llvm/test/tools/gold/X86/parallel.ll
+++ llvm/test/tools/gold/X86/parallel.ll
@@ -1,9 +1,9 @@
; RUN: llvm-as -o %t.bc %s
-; RUN: rm -f %t.opt.bc0 %t.opt.bc1 %t.o0 %t.o1
+; RUN: rm -f %t.0.5.precodegen.bc %t.1.5.precodegen.bc %t.o %t.o1
; RUN: env LD_PRELOAD=%llvmshlibdir/LLVMgold.so %gold -plugin %llvmshlibdir/LLVMgold.so -u foo -u bar -plugin-opt lto-partitions=2 -plugin-opt save-temps -m elf_x86_64 -o %t %t.bc
; RUN: llvm-dis %t.0.5.precodegen.bc -o - | FileCheck --check-prefix=CHECK-BC0 %s
; RUN: llvm-dis %t.1.5.precodegen.bc -o - | FileCheck --check-prefix=CHECK-BC1 %s
-; RUN: llvm-nm %t.o0 | FileCheck --check-prefix=CHECK0 %s
+; RUN: llvm-nm %t.o | FileCheck --check-prefix=CHECK0 %s
; RUN: llvm-nm %t.o1 | FileCheck --check-prefix=CHECK1 %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29160.85842.patch
Type: text/x-patch
Size: 2777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170126/6476642a/attachment.bin>
More information about the llvm-commits
mailing list