[llvm-commits] [llvm] r132775 - /llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp
Rafael Espindola
rafael.espindola at gmail.com
Thu Jun 9 07:38:09 PDT 2011
Author: rafael
Date: Thu Jun 9 09:38:09 2011
New Revision: 132775
URL: http://llvm.org/viewvc/llvm-project?rev=132775&view=rev
Log:
Improve the handling of available_externally and llvm.global_ctors.
Modified:
llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp
Modified: llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp?rev=132775&r1=132774&r2=132775&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp Thu Jun 9 09:38:09 2011
@@ -51,20 +51,32 @@
// 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;
More information about the llvm-commits
mailing list