Merge pull request #1142 from dbabokin/linker_fix
Move only unused declaration, the rest will be moved by Linker.
This commit is contained in:
@@ -906,6 +906,9 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
|
|||||||
// This trick should be legal, as both modules use the same LLVMContext.
|
// This trick should be legal, as both modules use the same LLVMContext.
|
||||||
for (llvm::Function& f : *bcModule) {
|
for (llvm::Function& f : *bcModule) {
|
||||||
if (f.isDeclaration()) {
|
if (f.isDeclaration()) {
|
||||||
|
// Declarations with uses will be moved by Linker.
|
||||||
|
if (f.getNumUses() > 0)
|
||||||
|
continue;
|
||||||
module->getOrInsertFunction(f.getName(), f.getFunctionType(),
|
module->getOrInsertFunction(f.getName(), f.getFunctionType(),
|
||||||
f.getAttributes());
|
f.getAttributes());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user