aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/gold
diff options
context:
space:
mode:
authorNoah Shutty <shutty@google.com>2021-10-18 18:40:57 -0700
committerPetr Hosek <phosek@google.com>2021-10-18 18:57:25 -0700
commite678c51177102845c93529d457b020f969125373 (patch)
tree62c816f4dda00dfa5519f6773a52e75759ba645b /llvm/tools/gold
parentfacff468b6c47b954aebd297c90bd44accaa54c6 (diff)
downloadllvm-e678c51177102845c93529d457b020f969125373.zip
llvm-e678c51177102845c93529d457b020f969125373.tar.gz
llvm-e678c51177102845c93529d457b020f969125373.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.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 6bcb1e4..ef30c5b 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -19,11 +19,11 @@
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DiagnosticPrinter.h"
-#include "llvm/LTO/Caching.h"
#include "llvm/LTO/LTO.h"
#include "llvm/Object/Error.h"
#include "llvm/Remarks/HotnessThresholdParser.h"
#include "llvm/Support/CachePruning.h"
+#include "llvm/Support/Caching.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Host.h"
@@ -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));