diff --git a/llvm/tools/lto/LTOCodeGenerator.cpp b/llvm/tools/lto/LTOCodeGenerator.cpp index 3ce22e5de411..0eb9a48d0dec 100644 --- a/llvm/tools/lto/LTOCodeGenerator.cpp +++ b/llvm/tools/lto/LTOCodeGenerator.cpp @@ -328,7 +328,7 @@ void LTOCodeGenerator::applyScopeRestrictions() { } for (Module::global_iterator v = mergedModule->global_begin(), e = mergedModule->global_end(); v != e; ++v) { - if (v->isDeclaration() && + if (!v->isDeclaration() && _mustPreserveSymbols.count(mangler.getNameWithPrefix(v))) mustPreserveList.push_back(::strdup(v->getNameStr().c_str())); }