summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/IPA/CallGraph.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-09-06 17:19:29 +0000
committerDuncan Sands <baldrick@free.fr>2008-09-06 17:19:29 +0000
commit95c2a7848ad8579a4d551078cd36501b28ad935d (patch)
tree36e37c0ae3d7bbbd793d980b48207d4151f9d813 /llvm/lib/Analysis/IPA/CallGraph.cpp
parentfc8c680b891083012eea7d032c5276e7e3fb64e2 (diff)
downloadbcm5719-llvm-95c2a7848ad8579a4d551078cd36501b28ad935d.tar.gz
bcm5719-llvm-95c2a7848ad8579a4d551078cd36501b28ad935d.zip
When PruneEH turned an invoke into an ordinary
call (thus changing the call site) it didn't inform the callgraph about this. But the call site does matter - as shown by the testcase, the callgraph become invalid after the inliner ran (with an edge between two functions simply missing), resulting in wrong deductions by GlobalsModRef. llvm-svn: 55872
Diffstat (limited to 'llvm/lib/Analysis/IPA/CallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/IPA/CallGraph.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/IPA/CallGraph.cpp b/llvm/lib/Analysis/IPA/CallGraph.cpp
index 5616ee9a4b0..c8f25b07b8d 100644
--- a/llvm/lib/Analysis/IPA/CallGraph.cpp
+++ b/llvm/lib/Analysis/IPA/CallGraph.cpp
@@ -297,7 +297,7 @@ void CallGraphNode::removeCallEdgeTo(CallGraphNode *Callee) {
/// should be used sparingly.
void CallGraphNode::removeCallEdgeFor(CallSite CS) {
for (unsigned i = CalledFunctions.size(); ; --i) {
- assert(i && "Cannot find callee to remove!");
+ assert(i && "Cannot find callsite to remove!");
if (CalledFunctions[i-1].first == CS) {
CalledFunctions.erase(CalledFunctions.begin()+i-1);
return;
@@ -318,5 +318,18 @@ void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee) {
}
}
+/// replaceCallSite - Make the edge in the node for Old CallSite be for
+/// New CallSite instead. Note that this method takes linear time, so it
+/// should be used sparingly.
+void CallGraphNode::replaceCallSite(CallSite Old, CallSite New) {
+ for (unsigned i = CalledFunctions.size(); ; --i) {
+ assert(i && "Cannot find callsite to replace!");
+ if (CalledFunctions[i-1].first == Old) {
+ CalledFunctions[i-1].first = New;
+ return;
+ }
+ }
+}
+
// Enuse that users of CallGraph.h also link with this file
DEFINING_FILE_FOR(CallGraph)
OpenPOWER on IntegriCloud