diff options
author | hrs <hrs@FreeBSD.org> | 2011-06-16 12:24:02 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2011-06-16 12:24:02 +0000 |
commit | 7afd303ca9e45353e1af220a988ddac723fde355 (patch) | |
tree | 356c3cc3903b4ba969f103c2c6ccc21fc748bdaa /contrib/llvm/lib/Transforms/IPO/ExtractGV.cpp | |
parent | b2a6f5600367e61c439c79db2317d4619960e2ce (diff) | |
parent | cc8fba8d7c933e32931cfc80150a2ed465e70825 (diff) | |
download | FreeBSD-src-7afd303ca9e45353e1af220a988ddac723fde355.zip FreeBSD-src-7afd303ca9e45353e1af220a988ddac723fde355.tar.gz |
Merge from HEAD@222977.
Diffstat (limited to 'contrib/llvm/lib/Transforms/IPO/ExtractGV.cpp')
-rw-r--r-- | contrib/llvm/lib/Transforms/IPO/ExtractGV.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/contrib/llvm/lib/Transforms/IPO/ExtractGV.cpp b/contrib/llvm/lib/Transforms/IPO/ExtractGV.cpp index 9d432de..d9911bf 100644 --- a/contrib/llvm/lib/Transforms/IPO/ExtractGV.cpp +++ b/contrib/llvm/lib/Transforms/IPO/ExtractGV.cpp @@ -51,20 +51,32 @@ namespace { // Visit the GlobalVariables. for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { + if (deleteStuff == (bool)Named.count(I) && !I->isDeclaration()) { + I->setInitializer(0); + } else { + if (I->hasAvailableExternallyLinkage()) + continue; + if (I->getName() == "llvm.global_ctors") + continue; + } + if (I->hasLocalLinkage()) I->setVisibility(GlobalValue::HiddenVisibility); I->setLinkage(GlobalValue::ExternalLinkage); - if (deleteStuff == (bool)Named.count(I) && !I->isDeclaration()) - I->setInitializer(0); } // Visit the Functions. for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { + if (deleteStuff == (bool)Named.count(I) && !I->isDeclaration()) { + I->deleteBody(); + } else { + if (I->hasAvailableExternallyLinkage()) + continue; + } + if (I->hasLocalLinkage()) I->setVisibility(GlobalValue::HiddenVisibility); I->setLinkage(GlobalValue::ExternalLinkage); - if (deleteStuff == (bool)Named.count(I) && !I->isDeclaration()) - I->deleteBody(); } return true; |