From 5ad2b1d54424f39390250d2ff11cc29312926efc Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 20 Apr 2004 20:20:59 +0000 Subject: [PATCH] Fix PR324 and testcase: Inline/2004-04-20-InlineLinkOnce.llx git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13080 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/Inliner.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index 8633a7e950f..0684c28697e 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/lib/Transforms/IPO/Inliner.cpp @@ -120,14 +120,18 @@ bool Inliner::runOnSCC(const std::vector &SCC) { (Callee->hasInternalLinkage() || Callee->hasLinkOnceLinkage())) { DEBUG(std::cerr << " -> Deleting dead function: " << Callee->getName() << "\n"); - std::set::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;