[llvm-commits] CVS: llvm/lib/Transforms/IPO/Inliner.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Jan 14 12:09:45 PST 2006



Changes in directory llvm/lib/Transforms/IPO:

Inliner.cpp updated: 1.25 -> 1.26
---
Log message:

Let the inliner update the callgraph to reflect the changes it makes, instead
of doing it ourselves.  This fixes Transforms/Inline/2006-01-14-CallGraphUpdate.ll


---
Diffs of the changes:  (+2 -12)

 Inliner.cpp |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)


Index: llvm/lib/Transforms/IPO/Inliner.cpp
diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.25 llvm/lib/Transforms/IPO/Inliner.cpp:1.26
--- llvm/lib/Transforms/IPO/Inliner.cpp:1.25	Fri Jan 13 12:06:56 2006
+++ llvm/lib/Transforms/IPO/Inliner.cpp	Sat Jan 14 14:09:18 2006
@@ -42,18 +42,7 @@
                                  const std::set<Function*> &SCCFunctions) {
   Function *Caller = CS.getInstruction()->getParent()->getParent();
   Function *Callee = CS.getCalledFunction();
-  if (!InlineFunction(CS)) return false;
-
-  // Update the call graph by deleting the edge from Callee to Caller
-  CallGraphNode *CalleeNode = CG[Callee];
-  CallGraphNode *CallerNode = CG[Caller];
-  CallerNode->removeCallEdgeTo(CalleeNode);
-
-  // Since we inlined all uninlined call sites in the callee into the caller,
-  // add edges from the caller to all of the callees of the callee.
-  for (CallGraphNode::iterator I = CalleeNode->begin(),
-         E = CalleeNode->end(); I != E; ++I)
-    CallerNode->addCalledFunction(*I);
+  if (!InlineFunction(CS, &CG)) return false;
 
   // If we inlined the last possible call site to the function, delete the
   // function body now.
@@ -63,6 +52,7 @@
                     << Callee->getName() << "\n");
 
     // Remove any call graph edges from the callee to its callees.
+    CallGraphNode *CalleeNode = CG[Callee];
     while (CalleeNode->begin() != CalleeNode->end())
       CalleeNode->removeCallEdgeTo(*(CalleeNode->end()-1));
 






More information about the llvm-commits mailing list