[PATCH] D61635: [ELF] Reorder BitcodeFiles.empty() to call thinLTOCreateEmptyIndexFiles() in only one place
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 7 03:38:26 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL360129: [ELF] Reorder BitcodeFiles.empty() to call thinLTOCreateEmptyIndexFiles() in… (authored by MaskRay, committed by ).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61635/new/
https://reviews.llvm.org/D61635
Files:
lld/trunk/ELF/LTO.cpp
lld/trunk/ELF/LTO.h
lld/trunk/ELF/SymbolTable.cpp
Index: lld/trunk/ELF/SymbolTable.cpp
===================================================================
--- lld/trunk/ELF/SymbolTable.cpp
+++ lld/trunk/ELF/SymbolTable.cpp
@@ -115,12 +115,6 @@
// Because all bitcode files that the program consists of are passed
// to the compiler at once, it can do whole-program optimization.
template <class ELFT> void SymbolTable::addCombinedLTOObject() {
- if (BitcodeFiles.empty()) {
- if (Config->ThinLTOIndexOnly)
- thinLTOCreateEmptyIndexFiles();
- return;
- }
-
// Compile bitcode files and replace bitcode symbols.
LTO.reset(new BitcodeCompiler);
for (BitcodeFile *F : BitcodeFiles)
Index: lld/trunk/ELF/LTO.h
===================================================================
--- lld/trunk/ELF/LTO.h
+++ lld/trunk/ELF/LTO.h
@@ -56,8 +56,6 @@
std::unique_ptr<llvm::raw_fd_ostream> IndexFile;
llvm::DenseSet<StringRef> ThinIndices;
};
-
-void thinLTOCreateEmptyIndexFiles();
} // namespace elf
} // namespace lld
Index: lld/trunk/ELF/LTO.cpp
===================================================================
--- lld/trunk/ELF/LTO.cpp
+++ lld/trunk/ELF/LTO.cpp
@@ -214,7 +214,7 @@
// If LazyObjFile has not been added to link, emit empty index files.
// This is needed because this is what GNU gold plugin does and we have a
// distributed build system that depends on that behavior.
-void elf::thinLTOCreateEmptyIndexFiles() {
+static void thinLTOCreateEmptyIndexFiles() {
for (LazyObjFile *F : LazyObjFiles) {
if (F->AddedToLink || !isBitcode(F->MB))
continue;
@@ -249,12 +249,13 @@
Files[Task] = std::move(MB);
}));
- checkError(LTOObj->run(
- [&](size_t Task) {
- return llvm::make_unique<lto::NativeObjectStream>(
- llvm::make_unique<raw_svector_ostream>(Buf[Task]));
- },
- Cache));
+ if (!BitcodeFiles.empty())
+ checkError(LTOObj->run(
+ [&](size_t Task) {
+ return llvm::make_unique<lto::NativeObjectStream>(
+ llvm::make_unique<raw_svector_ostream>(Buf[Task]));
+ },
+ Cache));
// Emit empty index files for non-indexed files
for (StringRef S : ThinIndices) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61635.198426.patch
Type: text/x-patch
Size: 2213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190507/ebcf835f/attachment.bin>
More information about the llvm-commits
mailing list