Move only unused declaration, the rest will be moved by Linker.

This commit is contained in:
Dmitry Babokin
2015-12-25 14:05:21 +03:00
parent 5ac46e5134
commit b67d7f0b6a

View File

@@ -906,6 +906,9 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
// This trick should be legal, as both modules use the same LLVMContext.
for (llvm::Function& f : *bcModule) {
if (f.isDeclaration()) {
// Declarations with uses will be moved by Linker.
if (f.getNumUses() > 0)
continue;
module->getOrInsertFunction(f.getName(), f.getFunctionType(),
f.getAttributes());
}