summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-20 19:00:50 +0000
committerChris Lattner <sabre@nondot.org>2003-09-20 19:00:50 +0000
commitc8dfbbbf25ea886df52dac3fcb7260a902ea8b22 (patch)
tree17fdf033f98aee0550f984f60cb6a3a62d9ee485 /llvm
parent689b6815582b410b1258de662f0154c8646f2706 (diff)
downloadbcm5719-llvm-c8dfbbbf25ea886df52dac3fcb7260a902ea8b22.tar.gz
bcm5719-llvm-c8dfbbbf25ea886df52dac3fcb7260a902ea8b22.zip
Global variables with APPENDING linkage are very important to keep around!
llvm-svn: 8632
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/IPO/GlobalDCE.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
index 2e18c43bac3..b47b365d59d 100644
--- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
@@ -48,14 +48,17 @@ bool GlobalDCE::run(Module &M) {
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
Changed |= RemoveUnusedConstantPointerRef(*I);
// Functions with external linkage are needed if they have a body
- if (I->hasExternalLinkage() && !I->isExternal())
+ if ((!I->hasInternalLinkage() && !I->hasLinkOnceLinkage()) &&
+ !I->isExternal())
GlobalIsNeeded(I);
}
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) {
Changed |= RemoveUnusedConstantPointerRef(*I);
- // Externally visible globals are needed, if they have an initializer.
- if (I->hasExternalLinkage() && !I->isExternal())
+ // Externally visible & appending globals are needed, if they have an
+ // initializer.
+ if ((!I->hasInternalLinkage() && !I->hasLinkOnceLinkage()) &&
+ !I->isExternal())
GlobalIsNeeded(I);
}
OpenPOWER on IntegriCloud