summaryrefslogtreecommitdiffstats
path: root/llvm/tools/gold/gold-plugin.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-08-26 23:29:14 +0000
committerTeresa Johnson <tejohnson@google.com>2016-08-26 23:29:14 +0000
commit26a462877b325db106e3a08cdd0dbda5533913a5 (patch)
tree8f50e4e38adb21d45bb1516b80fa07c3488f3047 /llvm/tools/gold/gold-plugin.cpp
parentac9c3a62a1e76df587fb14eb83be2229157962b1 (diff)
downloadbcm5719-llvm-26a462877b325db106e3a08cdd0dbda5533913a5.tar.gz
bcm5719-llvm-26a462877b325db106e3a08cdd0dbda5533913a5.zip
[ThinLTO] Move loading of cache entry to client
Summary: Have the cache pass back the path to the cache entry when it is ready to be loaded, instead of a buffer. For gold-plugin we can simply pass this file back to gold directly, which avoids expensive writing of a separate tmp file. Ensure the cache entry is not deleted on cleanup by adjusting the setting of the IsTemporary flags. Moved the loading of the buffer into llvm-lto2 to maintain current behavior. Reviewers: mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23946 llvm-svn: 279883
Diffstat (limited to 'llvm/tools/gold/gold-plugin.cpp')
-rw-r--r--llvm/tools/gold/gold-plugin.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 9a6fe270179..9c2280eb010 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -802,14 +802,13 @@ static ld_plugin_status allSymbolsReadHook() {
auto &OutputName = Filenames[Task];
getOutputFileName(Filename, /*TempOutFile=*/!SaveTemps, OutputName,
MaxTasks > 1 ? Task : -1);
- IsTemporary[Task] = !SaveTemps;
+ IsTemporary[Task] = !SaveTemps && options::cache_dir.empty();
if (options::cache_dir.empty())
return llvm::make_unique<LTOOutput>(OutputName);
return llvm::make_unique<CacheObjectOutput>(
- options::cache_dir, [OutputName](std::unique_ptr<MemoryBuffer> Buffer) {
- *LTOOutput(OutputName).getStream() << Buffer->getBuffer();
- });
+ options::cache_dir,
+ [&OutputName](std::string EntryPath) { OutputName = EntryPath; });
};
check(Lto->run(AddOutput));
OpenPOWER on IntegriCloud