Update the callgraph correctly.
authorDuncan Sands <baldrick@free.fr>
Mon, 8 Sep 2008 11:08:09 +0000 (11:08 +0000)
committerDuncan Sands <baldrick@free.fr>
Mon, 8 Sep 2008 11:08:09 +0000 (11:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55896 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/StructRetPromotion.cpp

index 2a7de3dc4918d5b8eaac5d1cc140b6cea401dc92..8e6415b2ab8bcd67e2a45f38860337bf06f0c593 100644 (file)
@@ -252,7 +252,7 @@ Function *SRETPromotion::cloneFunctionBody(Function *F,
 
 /// updateCallSites - Update all sites that call F to use NF.
 void SRETPromotion::updateCallSites(Function *F, Function *NF) {
-
+  CallGraph &CG = getAnalysis<CallGraph>();
   SmallVector<Value*, 16> Args;
 
   // ParamAttrs - Keep track of the parameter attributes for the arguments.
@@ -303,6 +303,9 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) {
     ArgAttrsVec.clear();
     New->takeName(Call);
 
+    // Update the callgraph to know that the callsite has been transformed.
+    CG[Call->getParent()->getParent()]->replaceCallSite(Call, New);
+
     // Update all users of sret parameter to extract value using extractvalue.
     for (Value::use_iterator UI = FirstCArg->use_begin(), 
            UE = FirstCArg->use_end(); UI != UE; ) {