diff options
author | Noah Shutty <shutty@google.com> | 2021-10-18 11:30:31 -0700 |
---|---|---|
committer | Petr Hosek <phosek@google.com> | 2021-10-18 12:08:49 -0700 |
commit | 92b8cc52bbc8194f2cd6a5f742b874969421afca (patch) | |
tree | 27dbaa55eef57b65665096b7eed3c9c64f0ae4eb /llvm/tools/gold | |
parent | 44b22f6f40f15ff24545c5fb0d612b3d86591955 (diff) | |
download | llvm-92b8cc52bbc8194f2cd6a5f742b874969421afca.zip llvm-92b8cc52bbc8194f2cd6a5f742b874969421afca.tar.gz llvm-92b8cc52bbc8194f2cd6a5f742b874969421afca.tar.bz2 |
[Support][ThinLTO] Move ThinLTO caching to LLVM Support library
We would like to move ThinLTO’s battle-tested file caching mechanism to
the LLVM Support library so that we can use it elsewhere in LLVM.
Patch By: noajshu
Differential Revision: https://reviews.llvm.org/D111371
Diffstat (limited to 'llvm/tools/gold')
-rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 6bcb1e4..7c97053 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -1081,12 +1081,11 @@ static std::vector<std::pair<SmallString<128>, bool>> runLTO() { size_t MaxTasks = Lto->getMaxTasks(); std::vector<std::pair<SmallString<128>, bool>> Files(MaxTasks); - auto AddStream = - [&](size_t Task) -> std::unique_ptr<lto::NativeObjectStream> { + auto AddStream = [&](size_t Task) -> std::unique_ptr<NativeObjectStream> { Files[Task].second = !SaveTemps; int FD = getOutputFileName(Filename, /* TempOutFile */ !SaveTemps, Files[Task].first, Task); - return std::make_unique<lto::NativeObjectStream>( + return std::make_unique<NativeObjectStream>( std::make_unique<llvm::raw_fd_ostream>(FD, true)); }; @@ -1096,7 +1095,7 @@ static std::vector<std::pair<SmallString<128>, bool>> runLTO() { NativeObjectCache Cache; if (!options::cache_dir.empty()) - Cache = check(localCache(options::cache_dir, AddBuffer)); + Cache = check(localCache("ThinLTO", "Thin", options::cache_dir, AddBuffer)); check(Lto->run(AddStream, Cache)); |