Skip to content

Commit f41e70d

Browse files
Revert [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols
This reverts r357931 (git commit 8b70a5c) llvm-svn: 357932
1 parent 8b70a5c commit f41e70d

File tree

7 files changed

+99
-184
lines changed

7 files changed

+99
-184
lines changed

llvm/include/llvm/LTO/LTO.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ class InputFile {
131131
using irsymtab::Symbol::isWeak;
132132
using irsymtab::Symbol::isIndirect;
133133
using irsymtab::Symbol::getName;
134-
using irsymtab::Symbol::getIRName;
135134
using irsymtab::Symbol::getVisibility;
136135
using irsymtab::Symbol::canBeOmittedFromSymbolTable;
137136
using irsymtab::Symbol::isTLS;
@@ -162,9 +161,6 @@ class InputFile {
162161
// Returns a table with all the comdats used by this file.
163162
ArrayRef<StringRef> getComdatTable() const { return ComdatTable; }
164163

165-
// Returns the only BitcodeModule from InputFile.
166-
BitcodeModule &getSingleBitcodeModule();
167-
168164
private:
169165
ArrayRef<Symbol> module_symbols(unsigned I) const {
170166
const auto &Indices = ModuleSymIndices[I];

llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "llvm/ADT/StringSet.h"
2020
#include "llvm/ADT/Triple.h"
2121
#include "llvm/IR/ModuleSummaryIndex.h"
22-
#include "llvm/LTO/LTO.h"
2322
#include "llvm/Support/CachePruning.h"
2423
#include "llvm/Support/CodeGen.h"
2524
#include "llvm/Support/MemoryBuffer.h"
@@ -32,6 +31,23 @@ class StringRef;
3231
class LLVMContext;
3332
class TargetMachine;
3433

34+
/// Wrapper around MemoryBufferRef, owning the identifier
35+
class ThinLTOBuffer {
36+
std::string OwnedIdentifier;
37+
StringRef Buffer;
38+
39+
public:
40+
ThinLTOBuffer(StringRef Buffer, StringRef Identifier)
41+
: OwnedIdentifier(Identifier), Buffer(Buffer) {}
42+
43+
MemoryBufferRef getMemBuffer() const {
44+
return MemoryBufferRef(Buffer,
45+
{OwnedIdentifier.c_str(), OwnedIdentifier.size()});
46+
}
47+
StringRef getBuffer() const { return Buffer; }
48+
StringRef getBufferIdentifier() const { return OwnedIdentifier; }
49+
};
50+
3551
/// Helper to gather options relevant to the target machine creation
3652
struct TargetMachineBuilder {
3753
Triple TheTriple;
@@ -251,36 +267,31 @@ class ThinLTOCodeGenerator {
251267
* and additionally resolve weak and linkonce symbols.
252268
* Index is updated to reflect linkage changes from weak resolution.
253269
*/
254-
void promote(Module &Module, ModuleSummaryIndex &Index,
255-
const lto::InputFile &File);
270+
void promote(Module &Module, ModuleSummaryIndex &Index);
256271

257272
/**
258273
* Compute and emit the imported files for module at \p ModulePath.
259274
*/
260275
void emitImports(Module &Module, StringRef OutputName,
261-
ModuleSummaryIndex &Index,
262-
const lto::InputFile &File);
276+
ModuleSummaryIndex &Index);
263277

264278
/**
265279
* Perform cross-module importing for the module identified by
266280
* ModuleIdentifier.
267281
*/
268-
void crossModuleImport(Module &Module, ModuleSummaryIndex &Index,
269-
const lto::InputFile &File);
282+
void crossModuleImport(Module &Module, ModuleSummaryIndex &Index);
270283

271284
/**
272285
* Compute the list of summaries needed for importing into module.
273286
*/
274287
void gatherImportedSummariesForModule(
275288
Module &Module, ModuleSummaryIndex &Index,
276-
std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex,
277-
const lto::InputFile &File);
289+
std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex);
278290

279291
/**
280292
* Perform internalization. Index is updated to reflect linkage changes.
281293
*/
282-
void internalize(Module &Module, ModuleSummaryIndex &Index,
283-
const lto::InputFile &File);
294+
void internalize(Module &Module, ModuleSummaryIndex &Index);
284295

285296
/**
286297
* Perform post-importing ThinLTO optimizations.
@@ -302,7 +313,7 @@ class ThinLTOCodeGenerator {
302313

303314
/// Vector holding the input buffers containing the bitcode modules to
304315
/// process.
305-
std::vector<std::unique_ptr<lto::InputFile>> Modules;
316+
std::vector<ThinLTOBuffer> Modules;
306317

307318
/// Set of symbols that need to be preserved outside of the set of bitcode
308319
/// files.

llvm/lib/LTO/LTO.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,6 @@ StringRef InputFile::getName() const {
420420
return Mods[0].getModuleIdentifier();
421421
}
422422

423-
BitcodeModule &InputFile::getSingleBitcodeModule() {
424-
assert(Mods.size() == 1 && "Expect only one bitcode module");
425-
return Mods[0];
426-
}
427-
428423
LTO::RegularLTOState::RegularLTOState(unsigned ParallelCodeGenParallelismLevel,
429424
Config &Conf)
430425
: ParallelCodeGenParallelismLevel(ParallelCodeGenParallelismLevel),

0 commit comments

Comments
 (0)