[llvm-commits] [llvm] r80708 - in /llvm/trunk: include/llvm/Analysis/CallGraph.h lib/Analysis/IPA/CallGraph.cpp lib/Analysis/IPA/CallGraphSCCPass.cpp lib/Transforms/IPO/ArgumentPromotion.cpp lib/Transforms/IPO/StructRetPromotion.cpp
Chris Lattner
sabre at nondot.org
Tue Sep 1 11:52:39 PDT 2009
Author: lattner
Date: Tue Sep 1 13:52:39 2009
New Revision: 80708
URL: http://llvm.org/viewvc/llvm-project?rev=80708&view=rev
Log:
remove CallGraphNode::replaceCallSite, it is redundant with other APIs.
Modified:
llvm/trunk/include/llvm/Analysis/CallGraph.h
llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=80708&r1=80707&r2=80708&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/CallGraph.h Tue Sep 1 13:52:39 2009
@@ -270,11 +270,6 @@
/// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite
/// from this node to the specified callee function.
void removeOneAbstractEdgeTo(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 replaceCallSite(CallSite Old, CallSite New, CallGraphNode *NewCallee);
};
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=80708&r1=80707&r2=80708&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Tue Sep 1 13:52:39 2009
@@ -279,27 +279,5 @@
}
}
-/// 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,
- CallGraphNode *NewCallee) {
- for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
- assert(I != CalledFunctions.end() && "Cannot find callsite to replace!");
- if (I->first != Old.getInstruction()) continue;
-
- I->first = New.getInstruction();
-
- // If the callee is changing, not just the callsite, then update it as
- // well.
- if (NewCallee) {
- I->second->DropRef();
- I->second = NewCallee;
- I->second->AddRef();
- }
- return;
- }
-}
-
// Enuse that users of CallGraph.h also link with this file
DEFINING_FILE_FOR(CallGraph)
Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80708&r1=80707&r2=80708&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep 1 13:52:39 2009
@@ -228,7 +228,7 @@
else
CalleeNode = CG.getCallsExternalNode();
- CGN->replaceCallSite(CS, CS, CalleeNode);
+ ExistingIt->second = CalleeNode;
MadeChange = true;
continue;
}
Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=80708&r1=80707&r2=80708&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Tue Sep 1 13:52:39 2009
@@ -728,7 +728,9 @@
AA.replaceWithNewValue(Call, New);
// Update the callgraph to know that the callsite has been transformed.
- CG[Call->getParent()->getParent()]->replaceCallSite(Call, New, NF_CGN);
+ CallGraphNode *CalleeNode = CG[Call->getParent()->getParent()];
+ CalleeNode->removeCallEdgeFor(Call);
+ CalleeNode->addCalledFunction(New, NF_CGN);
if (!Call->use_empty()) {
Call->replaceAllUsesWith(New);
Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=80708&r1=80707&r2=80708&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Tue Sep 1 13:52:39 2009
@@ -321,7 +321,9 @@
New->takeName(Call);
// Update the callgraph to know that the callsite has been transformed.
- CG[Call->getParent()->getParent()]->replaceCallSite(Call, New, NF_CGN);
+ CallGraphNode *CalleeNode = CG[Call->getParent()->getParent()];
+ CalleeNode->removeCallEdgeFor(Call);
+ CalleeNode->addCalledFunction(New, NF_CGN);
// Update all users of sret parameter to extract value using extractvalue.
for (Value::use_iterator UI = FirstCArg->use_begin(),
More information about the llvm-commits
mailing list