From b67d7f0b6aba39b457ef716693508d617274c834 Mon Sep 17 00:00:00 2001 From: Dmitry Babokin Date: Fri, 25 Dec 2015 14:05:21 +0300 Subject: [PATCH] Move only unused declaration, the rest will be moved by Linker. --- builtins.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtins.cpp b/builtins.cpp index 3ed1e6d7..d65882c1 100644 --- a/builtins.cpp +++ b/builtins.cpp @@ -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()); }