From c94fe21a56f9e4e5ebbe99252a25636c36392509 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Fri, 5 Sep 2008 21:43:04 +0000 Subject: Delete the removeCallEdgeTo callgraph method, because it does not maintain a correct list of callsites. I discovered (see following commit) that the inliner will create a wrong callgraph if it is fed a callgraph with correct edges but incorrect callsites. These were created by Prune-EH, and while it wasn't done via removeCallEdgeTo, it could have been done via removeCallEdgeTo, which is an accident waiting to happen. Use removeCallEdgeFor instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55859 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/PruneEH.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'lib/Transforms/IPO/PruneEH.cpp') diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp index 8fb904b1ea..94d6331ddd 100644 --- a/lib/Transforms/IPO/PruneEH.cpp +++ b/lib/Transforms/IPO/PruneEH.cpp @@ -222,13 +222,10 @@ void PruneEH::DeleteBasicBlock(BasicBlock *BB) { CallGraphNode *CGN = CG[BB->getParent()]; for (BasicBlock::iterator I = BB->end(), E = BB->begin(); I != E; ) { --I; - if (CallInst *CI = dyn_cast(I)) { - if (Function *Callee = CI->getCalledFunction()) - CGN->removeCallEdgeTo(CG[Callee]); - } else if (InvokeInst *II = dyn_cast(I)) { - if (Function *Callee = II->getCalledFunction()) - CGN->removeCallEdgeTo(CG[Callee]); - } + if (CallInst *CI = dyn_cast(I)) + CGN->removeCallEdgeFor(CI); + else if (InvokeInst *II = dyn_cast(I)) + CGN->removeCallEdgeFor(II); if (!I->use_empty()) I->replaceAllUsesWith(UndefValue::get(I->getType())); } -- cgit v1.2.3