summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-04-20 20:20:59 +0000
committerChris Lattner <sabre@nondot.org>2004-04-20 20:20:59 +0000
commit514934051a19b4a53782bc2914d6ae21c29758db (patch)
treef7ce40446eea1e4fa9c2c6e7ff4948fde399938b /llvm/lib/Transforms
parent40123bff5ba6902d6f557791cc71fe9e4e9133d7 (diff)
downloadbcm5719-llvm-514934051a19b4a53782bc2914d6ae21c29758db.tar.gz
bcm5719-llvm-514934051a19b4a53782bc2914d6ae21c29758db.zip
Fix PR324 and testcase: Inline/2004-04-20-InlineLinkOnce.llx
llvm-svn: 13080
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/Inliner.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index 8633a7e950f..0684c28697e 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -120,14 +120,18 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
(Callee->hasInternalLinkage() || Callee->hasLinkOnceLinkage())) {
DEBUG(std::cerr << " -> Deleting dead function: "
<< Callee->getName() << "\n");
- std::set<Function*>::iterator I = SCCFunctions.find(Callee);
- if (I != SCCFunctions.end()) // Remove function from this SCC.
- SCCFunctions.erase(I);
+ SCCFunctions.erase(Callee); // Remove function from this SCC.
// Remove any call graph edges from the callee to its callees.
while (CalleeNode->begin() != CalleeNode->end())
CalleeNode->removeCallEdgeTo(*(CalleeNode->end()-1));
+ // If the function has external linkage (basically if it's a
+ // linkonce function) remove the edge from the external node to the
+ // callee node.
+ if (!Callee->hasInternalLinkage())
+ CG.getExternalCallingNode()->removeCallEdgeTo(CalleeNode);
+
// Removing the node for callee from the call graph and delete it.
delete CG.removeFunctionFromModule(CalleeNode);
++NumDeleted;
OpenPOWER on IntegriCloud