diff options
author | Hongtao Yu <hoy@fb.com> | 2021-02-05 13:17:51 -0800 |
---|---|---|
committer | Hongtao Yu <hoy@fb.com> | 2021-02-12 09:40:08 -0800 |
commit | 0b1914e83a03be926569892c17ca743c5ea46d1f (patch) | |
tree | 0f7f1bc981e177c2cfd5c53fa71abe0e4dc9f153 /llvm/tools/gold | |
parent | 66900b3eae96b295cc7eb9468680085028f35daa (diff) | |
download | llvm-0b1914e83a03be926569892c17ca743c5ea46d1f.zip llvm-0b1914e83a03be926569892c17ca743c5ea46d1f.tar.gz llvm-0b1914e83a03be926569892c17ca743c5ea46d1f.tar.bz2 |
[ThinLTO][gold] Fix filenaming scheme for tasks.
The gold LTO plugin uses a set of hooks to implements emit-llvm and capture intermediate file generated during LTO. The hooks are called by each lto backend thread with a taskID as argument to differentiate between threads and tasks. Currently, all threads are overwriting the same file which results into only the intermediate output of the last backend thread to be preserved. This diff encodes the taskID into the filename.
Reviewed By: tejohnson, wenlei
Differential Revision: https://reviews.llvm.org/D96173
Diffstat (limited to 'llvm/tools/gold')
-rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index c0e0d5b..38f9596 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -915,7 +915,10 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite, case options::OT_BC_ONLY: Conf.PostInternalizeModuleHook = [](size_t Task, const Module &M) { std::error_code EC; - raw_fd_ostream OS(output_name, EC, sys::fs::OpenFlags::OF_None); + SmallString<128> TaskFilename; + getOutputFileName(output_name, /* TempOutFile */ false, TaskFilename, + Task); + raw_fd_ostream OS(TaskFilename, EC, sys::fs::OpenFlags::OF_None); if (EC) message(LDPL_FATAL, "Failed to write the output file."); WriteBitcodeToFile(M, OS, /* ShouldPreserveUseListOrder */ false); |