[llvm-commits] [llvm] r114666 - in /llvm/trunk: lib/Transforms/IPO/ExtractGV.cpp test/Other/extract.ll
Bob Wilson
bob.wilson at apple.com
Thu Sep 23 10:25:06 PDT 2010
Author: bwilson
Date: Thu Sep 23 12:25:06 2010
New Revision: 114666
URL: http://llvm.org/viewvc/llvm-project?rev=114666&view=rev
Log:
Fix llvm-extract so that it changes the linkage of all GlobalValues to
"external" even when doing lazy bitcode loading. This was broken because
a function that is not materialized fails the !isDeclaration() test.
Modified:
llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp
llvm/trunk/test/Other/extract.ll
Modified: llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp?rev=114666&r1=114665&r2=114666&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp Thu Sep 23 12:25:06 2010
@@ -50,24 +50,22 @@
// Visit the GlobalVariables.
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
- I != E; ++I)
- if (!I->isDeclaration()) {
- if (I->hasLocalLinkage())
- I->setVisibility(GlobalValue::HiddenVisibility);
- I->setLinkage(GlobalValue::ExternalLinkage);
- if (deleteStuff == (bool)Named.count(I))
- I->setInitializer(0);
- }
+ I != E; ++I) {
+ 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 (!I->isDeclaration()) {
- if (I->hasLocalLinkage())
- I->setVisibility(GlobalValue::HiddenVisibility);
- I->setLinkage(GlobalValue::ExternalLinkage);
- if (deleteStuff == (bool)Named.count(I))
- I->deleteBody();
- }
+ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
+ if (I->hasLocalLinkage())
+ I->setVisibility(GlobalValue::HiddenVisibility);
+ I->setLinkage(GlobalValue::ExternalLinkage);
+ if (deleteStuff == (bool)Named.count(I) && !I->isDeclaration())
+ I->deleteBody();
+ }
return true;
}
Modified: llvm/trunk/test/Other/extract.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/extract.ll?rev=114666&r1=114665&r2=114666&view=diff
==============================================================================
--- llvm/trunk/test/Other/extract.ll (original)
+++ llvm/trunk/test/Other/extract.ll Thu Sep 23 12:25:06 2010
@@ -10,13 +10,18 @@
; CHECK: define void @foo() {
; CHECK: ret void
; CHECK: }
+
+; The linkonce_odr linkage for foo() should be changed to external linkage.
+; DELETE: declare void @foo()
; DELETE: define void @bar() {
+; DELETE: call void @foo()
; DELETE: ret void
; DELETE: }
-define void @foo() {
+define linkonce_odr void @foo() {
ret void
}
define void @bar() {
+ call void @foo()
ret void
}
More information about the llvm-commits
mailing list