diff options
| author | Torok Edwin <edwintorok@gmail.com> | 2009-05-23 14:06:57 +0000 |
|---|---|---|
| committer | Torok Edwin <edwintorok@gmail.com> | 2009-05-23 14:06:57 +0000 |
| commit | 7996339dd8d6485f23ccebddbc464cc912a84e2a (patch) | |
| tree | 4838390ff61d86db54e5ddeaf5c2262a83212179 /llvm/lib/Transforms/IPO | |
| parent | 53a71147bae783da16253bf80f4d0c9e4a8aba50 (diff) | |
| download | bcm5719-llvm-7996339dd8d6485f23ccebddbc464cc912a84e2a.tar.gz bcm5719-llvm-7996339dd8d6485f23ccebddbc464cc912a84e2a.zip | |
available_externall linkage is not local, this was confusing the codegenerator,
and it wasn't generating calls through @PLT for these functions.
hasLocalLinkage() is now false for available_externally,
I attempted to fix the inliner and dce to handle available_externally properly.
It passed make check.
llvm-svn: 72328
Diffstat (limited to 'llvm/lib/Transforms/IPO')
| -rw-r--r-- | llvm/lib/Transforms/IPO/GlobalDCE.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp index 4f97ae175b1..db378b0d0b2 100644 --- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp +++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp @@ -64,7 +64,7 @@ bool GlobalDCE::runOnModule(Module &M) { Changed |= RemoveUnusedGlobalValue(*I); // Functions with external linkage are needed if they have a body if (!I->hasLocalLinkage() && !I->hasLinkOnceLinkage() && - !I->isDeclaration()) + !I->isDeclaration() && !I->hasAvailableExternallyLinkage()) GlobalIsNeeded(I); } @@ -74,7 +74,7 @@ bool GlobalDCE::runOnModule(Module &M) { // Externally visible & appending globals are needed, if they have an // initializer. if (!I->hasLocalLinkage() && !I->hasLinkOnceLinkage() && - !I->isDeclaration()) + !I->isDeclaration() && !I->hasAvailableExternallyLinkage()) GlobalIsNeeded(I); } diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index b589792022a..b382837289b 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -69,7 +69,8 @@ bool Inliner::InlineCallIfPossible(CallSite CS, CallGraph &CG, // If we inlined the last possible call site to the function, delete the // function body now. - if (Callee->use_empty() && Callee->hasLocalLinkage() && + if (Callee->use_empty() && (Callee->hasLocalLinkage() || + Callee->hasAvailableExternallyLinkage()) && !SCCFunctions.count(Callee)) { DOUT << " -> Deleting dead function: " << Callee->getName() << "\n"; CallGraphNode *CalleeNode = CG[Callee]; |

