summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-10-28 00:24:16 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-10-28 00:24:16 +0000
commit9f8eff31db00ba4efdef4c81858d12a7e9c93b46 (patch)
treed6f22e338845c1825cfd2c8fffa0141ffd0b83c2 /llvm/lib
parent294eecf69e9b36bf67d96ffa162ed3372a14c4ee (diff)
downloadbcm5719-llvm-9f8eff31db00ba4efdef4c81858d12a7e9c93b46.tar.gz
bcm5719-llvm-9f8eff31db00ba4efdef4c81858d12a7e9c93b46.zip
Remove the PreserveSource linker mode.
I noticed that it was untested, and forcing it on caused some tests to fail: LLVM :: Linker/metadata-a.ll LLVM :: Linker/prefixdata.ll LLVM :: Linker/type-unique-odr-a.ll LLVM :: Linker/type-unique-simple-a.ll LLVM :: Linker/type-unique-simple2-a.ll LLVM :: Linker/type-unique-simple2.ll LLVM :: Linker/type-unique-type-array-a.ll LLVM :: Linker/unnamed-addr1-a.ll LLVM :: Linker/visibility1.ll If it is to be resurrected, it has to be fixed and we should probably have a -preserve-source command line option in llvm-mc and run tests with and without it. llvm-svn: 220741
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp49
1 files changed, 20 insertions, 29 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 1e08262c8bd..403a1ff90c5 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -410,8 +410,6 @@ namespace {
std::vector<AppendingVarInfo> AppendingVars;
- unsigned Mode; // Mode to treat source module.
-
// Set of items not to link in from source.
SmallPtrSet<const Value*, 16> DoNotLinkFromSource;
@@ -421,10 +419,10 @@ namespace {
Linker::DiagnosticHandlerFunction DiagnosticHandler;
public:
- ModuleLinker(Module *dstM, TypeSet &Set, Module *srcM, unsigned mode,
+ ModuleLinker(Module *dstM, TypeSet &Set, Module *srcM,
Linker::DiagnosticHandlerFunction DiagnosticHandler)
: DstM(dstM), SrcM(srcM), TypeMap(Set),
- ValMaterializer(TypeMap, DstM, LazilyLinkFunctions), Mode(mode),
+ ValMaterializer(TypeMap, DstM, LazilyLinkFunctions),
DiagnosticHandler(DiagnosticHandler) {}
bool run();
@@ -1337,25 +1335,17 @@ void ModuleLinker::linkFunctionBody(Function *Dst, Function *Src) {
ValueMap[I] = DI;
}
- if (Mode == Linker::DestroySource) {
- // Splice the body of the source function into the dest function.
- Dst->getBasicBlockList().splice(Dst->end(), Src->getBasicBlockList());
-
- // At this point, all of the instructions and values of the function are now
- // copied over. The only problem is that they are still referencing values in
- // the Source function as operands. Loop through all of the operands of the
- // functions and patch them up to point to the local versions.
- for (Function::iterator BB = Dst->begin(), BE = Dst->end(); BB != BE; ++BB)
- for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
- RemapInstruction(I, ValueMap, RF_IgnoreMissingEntries,
- &TypeMap, &ValMaterializer);
+ // Splice the body of the source function into the dest function.
+ Dst->getBasicBlockList().splice(Dst->end(), Src->getBasicBlockList());
- } else {
- // Clone the body of the function into the dest function.
- SmallVector<ReturnInst*, 8> Returns; // Ignore returns.
- CloneFunctionInto(Dst, Src, ValueMap, false, Returns, "", nullptr,
- &TypeMap, &ValMaterializer);
- }
+ // At this point, all of the instructions and values of the function are now
+ // copied over. The only problem is that they are still referencing values in
+ // the Source function as operands. Loop through all of the operands of the
+ // functions and patch them up to point to the local versions.
+ for (Function::iterator BB = Dst->begin(), BE = Dst->end(); BB != BE; ++BB)
+ for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
+ RemapInstruction(I, ValueMap, RF_IgnoreMissingEntries, &TypeMap,
+ &ValMaterializer);
// There is no need to map the arguments anymore.
for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end();
@@ -1745,8 +1735,9 @@ void Linker::deleteModule() {
Composite = nullptr;
}
-bool Linker::linkInModule(Module *Src, unsigned Mode) {
- ModuleLinker TheLinker(Composite, IdentifiedStructTypes, Src, Mode, DiagnosticHandler);
+bool Linker::linkInModule(Module *Src) {
+ ModuleLinker TheLinker(Composite, IdentifiedStructTypes, Src,
+ DiagnosticHandler);
return TheLinker.run();
}
@@ -1759,15 +1750,15 @@ bool Linker::linkInModule(Module *Src, unsigned Mode) {
/// true is returned and ErrorMsg (if not null) is set to indicate the problem.
/// Upon failure, the Dest module could be in a modified state, and shouldn't be
/// relied on to be consistent.
-bool Linker::LinkModules(Module *Dest, Module *Src, unsigned Mode,
+bool Linker::LinkModules(Module *Dest, Module *Src,
DiagnosticHandlerFunction DiagnosticHandler) {
Linker L(Dest, DiagnosticHandler);
- return L.linkInModule(Src, Mode);
+ return L.linkInModule(Src);
}
-bool Linker::LinkModules(Module *Dest, Module *Src, unsigned Mode) {
+bool Linker::LinkModules(Module *Dest, Module *Src) {
Linker L(Dest);
- return L.linkInModule(Src, Mode);
+ return L.linkInModule(Src);
}
//===----------------------------------------------------------------------===//
@@ -1782,7 +1773,7 @@ LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
DiagnosticPrinterRawOStream DP(Stream);
LLVMBool Result = Linker::LinkModules(
- D, unwrap(Src), Mode, [&](const DiagnosticInfo &DI) { DI.print(DP); });
+ D, unwrap(Src), [&](const DiagnosticInfo &DI) { DI.print(DP); });
if (OutMessages && Result)
*OutMessages = strdup(Message.c_str());
OpenPOWER on IntegriCloud