Inliner.cpp revision 844731a7f1909f55935e3514c9e713a62d67662e
1cf5933a716e7eb6bd5ff49aa62f3e76379ebaf51Chris Lattner//===- Inliner.cpp - Code common to all inliners --------------------------===// 2fd93908ae8b9684fe71c239e3c6cfe13ff6a2663Misha Brukman// 3b576c94c15af9a440f69d9d03c2afead7971118cJohn Criswell// The LLVM Compiler Infrastructure 4b576c94c15af9a440f69d9d03c2afead7971118cJohn Criswell// 54ee451de366474b9c228b4e5fa573795a715216dChris Lattner// This file is distributed under the University of Illinois Open Source 64ee451de366474b9c228b4e5fa573795a715216dChris Lattner// License. See LICENSE.TXT for details. 7fd93908ae8b9684fe71c239e3c6cfe13ff6a2663Misha Brukman// 8b576c94c15af9a440f69d9d03c2afead7971118cJohn Criswell//===----------------------------------------------------------------------===// 9237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner// 10befa499d45ffcc32bd9902518aec18589464e47cChris Lattner// This file implements the mechanics required to implement inlining without 11befa499d45ffcc32bd9902518aec18589464e47cChris Lattner// missing any calls and updating the call graph. The decisions of which calls 12befa499d45ffcc32bd9902518aec18589464e47cChris Lattner// are profitable to inline are implemented elsewhere. 13237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner// 14237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner//===----------------------------------------------------------------------===// 15237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner 1686453c52ba02e743d29c08456e51006500041456Chris Lattner#define DEBUG_TYPE "inline" 17237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner#include "llvm/Module.h" 1847b14a4a6a455c7be169cfd312fcbe796f0ad426Misha Brukman#include "llvm/Instructions.h" 19237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner#include "llvm/Analysis/CallGraph.h" 20237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner#include "llvm/Support/CallSite.h" 21ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner#include "llvm/Target/TargetData.h" 226f7426ec2e46bb19cc9f9e75f1c355b35cf12d7dTanya Lattner#include "llvm/Transforms/IPO/InlinerPass.h" 23237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner#include "llvm/Transforms/Utils/Cloning.h" 24551ccae044b0ff658fe629dd67edd5ffe75d10e8Reid Spencer#include "llvm/Support/CommandLine.h" 25551ccae044b0ff658fe629dd67edd5ffe75d10e8Reid Spencer#include "llvm/Support/Debug.h" 26551ccae044b0ff658fe629dd67edd5ffe75d10e8Reid Spencer#include "llvm/ADT/Statistic.h" 27befa499d45ffcc32bd9902518aec18589464e47cChris Lattner#include <set> 28a51bcb50b0c74adc741361824ef81dbefb715c53Chris Lattnerusing namespace llvm; 29d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 3086453c52ba02e743d29c08456e51006500041456Chris LattnerSTATISTIC(NumInlined, "Number of functions inlined"); 3186453c52ba02e743d29c08456e51006500041456Chris LattnerSTATISTIC(NumDeleted, "Number of functions deleted because all callers found"); 3286453c52ba02e743d29c08456e51006500041456Chris Lattner 33844731a7f1909f55935e3514c9e713a62d67662eDan Gohmanstatic cl::opt<int> 34844731a7f1909f55935e3514c9e713a62d67662eDan GohmanInlineLimit("inline-threshold", cl::Hidden, cl::init(200), 357c3becd9d729b976d79b18e6165e74390e613bb5Evan Cheng cl::desc("Control the amount of inlining to perform (default = 200)")); 36237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner 371ce6f8da7283a1f281f1767905873537d66560d5Chris LattnerInliner::Inliner(const void *ID) 381ce6f8da7283a1f281f1767905873537d66560d5Chris Lattner : CallGraphSCCPass((intptr_t)ID), InlineThreshold(InlineLimit) {} 39237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner 40120d053e3ba810b44047fbcb719824bed5673ca9Chris LattnerInliner::Inliner(const void *ID, int Threshold) 41120d053e3ba810b44047fbcb719824bed5673ca9Chris Lattner : CallGraphSCCPass((intptr_t)ID), InlineThreshold(Threshold) {} 42120d053e3ba810b44047fbcb719824bed5673ca9Chris Lattner 43ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner/// getAnalysisUsage - For this class, we declare that we require and preserve 44ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner/// the call graph. If the derived class implements this method, it should 45ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner/// always explicitly call the implementation here. 46ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattnervoid Inliner::getAnalysisUsage(AnalysisUsage &Info) const { 47ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner Info.addRequired<TargetData>(); 48ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner CallGraphSCCPass::getAnalysisUsage(Info); 49ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner} 50ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner 51befa499d45ffcc32bd9902518aec18589464e47cChris Lattner// InlineCallIfPossible - If it is possible to inline the specified call site, 52befa499d45ffcc32bd9902518aec18589464e47cChris Lattner// do so and update the CallGraph for this operation. 53befa499d45ffcc32bd9902518aec18589464e47cChris Lattnerstatic bool InlineCallIfPossible(CallSite CS, CallGraph &CG, 54ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner const std::set<Function*> &SCCFunctions, 55ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner const TargetData &TD) { 56befa499d45ffcc32bd9902518aec18589464e47cChris Lattner Function *Callee = CS.getCalledFunction(); 57ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner if (!InlineFunction(CS, &CG, &TD)) return false; 58fd93908ae8b9684fe71c239e3c6cfe13ff6a2663Misha Brukman 5954970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner // If we inlined the last possible call site to the function, delete the 6054970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner // function body now. 61befa499d45ffcc32bd9902518aec18589464e47cChris Lattner if (Callee->use_empty() && Callee->hasInternalLinkage() && 62befa499d45ffcc32bd9902518aec18589464e47cChris Lattner !SCCFunctions.count(Callee)) { 630a81aac4b46eed130d20714af5a1c01b05d0275eBill Wendling DOUT << " -> Deleting dead function: " << Callee->getName() << "\n"; 64fd93908ae8b9684fe71c239e3c6cfe13ff6a2663Misha Brukman 65befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // Remove any call graph edges from the callee to its callees. 66432a205769d22e7744dd8b0b45efd687aa6998e3Chris Lattner CallGraphNode *CalleeNode = CG[Callee]; 67cb406c25973b4e88a6c10ad839ef1beeb3664715Dan Gohman while (!CalleeNode->empty()) 68d85340f4ec587e22b0239617f3b747a6df113894Chris Lattner CalleeNode->removeCallEdgeTo((CalleeNode->end()-1)->second); 69fd93908ae8b9684fe71c239e3c6cfe13ff6a2663Misha Brukman 70befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // Removing the node for callee from the call graph and delete it. 71befa499d45ffcc32bd9902518aec18589464e47cChris Lattner delete CG.removeFunctionFromModule(CalleeNode); 72befa499d45ffcc32bd9902518aec18589464e47cChris Lattner ++NumDeleted; 73befa499d45ffcc32bd9902518aec18589464e47cChris Lattner } 74befa499d45ffcc32bd9902518aec18589464e47cChris Lattner return true; 75237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner} 76237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner 77237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattnerbool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) { 78237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner CallGraph &CG = getAnalysis<CallGraph>(); 79237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner 80237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner std::set<Function*> SCCFunctions; 810a81aac4b46eed130d20714af5a1c01b05d0275eBill Wendling DOUT << "Inliner visiting SCC:"; 82237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner for (unsigned i = 0, e = SCC.size(); i != e; ++i) { 83befa499d45ffcc32bd9902518aec18589464e47cChris Lattner Function *F = SCC[i]->getFunction(); 84befa499d45ffcc32bd9902518aec18589464e47cChris Lattner if (F) SCCFunctions.insert(F); 850a81aac4b46eed130d20714af5a1c01b05d0275eBill Wendling DOUT << " " << (F ? F->getName() : "INDIRECTNODE"); 86237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner } 87237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner 88befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // Scan through and identify all call sites ahead of time so that we only 89befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // inline call sites in the original functions, not call sites that result 90befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // from inlining other functions. 91befa499d45ffcc32bd9902518aec18589464e47cChris Lattner std::vector<CallSite> CallSites; 92befa499d45ffcc32bd9902518aec18589464e47cChris Lattner 93cf5933a716e7eb6bd5ff49aa62f3e76379ebaf51Chris Lattner for (unsigned i = 0, e = SCC.size(); i != e; ++i) 94cf5933a716e7eb6bd5ff49aa62f3e76379ebaf51Chris Lattner if (Function *F = SCC[i]->getFunction()) 95befa499d45ffcc32bd9902518aec18589464e47cChris Lattner for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) 96befa499d45ffcc32bd9902518aec18589464e47cChris Lattner for (BasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) { 97befa499d45ffcc32bd9902518aec18589464e47cChris Lattner CallSite CS = CallSite::get(I); 98befa499d45ffcc32bd9902518aec18589464e47cChris Lattner if (CS.getInstruction() && (!CS.getCalledFunction() || 995cbf985dcbc89fba3208e7baf8b6f488b06d3ec9Reid Spencer !CS.getCalledFunction()->isDeclaration())) 100befa499d45ffcc32bd9902518aec18589464e47cChris Lattner CallSites.push_back(CS); 101befa499d45ffcc32bd9902518aec18589464e47cChris Lattner } 102237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner 1030a81aac4b46eed130d20714af5a1c01b05d0275eBill Wendling DOUT << ": " << CallSites.size() << " call sites.\n"; 104fd93908ae8b9684fe71c239e3c6cfe13ff6a2663Misha Brukman 105befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // Now that we have all of the call sites, move the ones to functions in the 106befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // current SCC to the end of the list. 107befa499d45ffcc32bd9902518aec18589464e47cChris Lattner unsigned FirstCallInSCC = CallSites.size(); 108befa499d45ffcc32bd9902518aec18589464e47cChris Lattner for (unsigned i = 0; i < FirstCallInSCC; ++i) 109befa499d45ffcc32bd9902518aec18589464e47cChris Lattner if (Function *F = CallSites[i].getCalledFunction()) 110befa499d45ffcc32bd9902518aec18589464e47cChris Lattner if (SCCFunctions.count(F)) 111befa499d45ffcc32bd9902518aec18589464e47cChris Lattner std::swap(CallSites[i--], CallSites[--FirstCallInSCC]); 112fd93908ae8b9684fe71c239e3c6cfe13ff6a2663Misha Brukman 113befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // Now that we have all of the call sites, loop over them and inline them if 114befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // it looks profitable to do so. 115befa499d45ffcc32bd9902518aec18589464e47cChris Lattner bool Changed = false; 116befa499d45ffcc32bd9902518aec18589464e47cChris Lattner bool LocalChange; 117befa499d45ffcc32bd9902518aec18589464e47cChris Lattner do { 118befa499d45ffcc32bd9902518aec18589464e47cChris Lattner LocalChange = false; 119befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // Iterate over the outer loop because inlining functions can cause indirect 120befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // calls to become direct calls. 121befa499d45ffcc32bd9902518aec18589464e47cChris Lattner for (unsigned CSi = 0; CSi != CallSites.size(); ++CSi) 122befa499d45ffcc32bd9902518aec18589464e47cChris Lattner if (Function *Callee = CallSites[CSi].getCalledFunction()) { 123befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // Calls to external functions are never inlinable. 1245cbf985dcbc89fba3208e7baf8b6f488b06d3ec9Reid Spencer if (Callee->isDeclaration() || 125befa499d45ffcc32bd9902518aec18589464e47cChris Lattner CallSites[CSi].getInstruction()->getParent()->getParent() ==Callee){ 12608ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner if (SCC.size() == 1) { 12708ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner std::swap(CallSites[CSi], CallSites.back()); 12808ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner CallSites.pop_back(); 12908ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner } else { 13008ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner // Keep the 'in SCC / not in SCC' boundary correct. 13108ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner CallSites.erase(CallSites.begin()+CSi); 13208ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner } 133befa499d45ffcc32bd9902518aec18589464e47cChris Lattner --CSi; 134befa499d45ffcc32bd9902518aec18589464e47cChris Lattner continue; 135befa499d45ffcc32bd9902518aec18589464e47cChris Lattner } 136befa499d45ffcc32bd9902518aec18589464e47cChris Lattner 137befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // If the policy determines that we should inline this function, 138befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // try to do so. 139befa499d45ffcc32bd9902518aec18589464e47cChris Lattner CallSite CS = CallSites[CSi]; 140befa499d45ffcc32bd9902518aec18589464e47cChris Lattner int InlineCost = getInlineCost(CS); 1418d84d5b62cdf2a772d51338136c7022a6e1ff931Evan Cheng float FudgeFactor = getInlineFudgeFactor(CS); 1428d84d5b62cdf2a772d51338136c7022a6e1ff931Evan Cheng 1438d84d5b62cdf2a772d51338136c7022a6e1ff931Evan Cheng if (InlineCost >= (int)(InlineThreshold * FudgeFactor)) { 1440a81aac4b46eed130d20714af5a1c01b05d0275eBill Wendling DOUT << " NOT Inlining: cost=" << InlineCost 1450a81aac4b46eed130d20714af5a1c01b05d0275eBill Wendling << ", Call: " << *CS.getInstruction(); 146befa499d45ffcc32bd9902518aec18589464e47cChris Lattner } else { 1470a81aac4b46eed130d20714af5a1c01b05d0275eBill Wendling DOUT << " Inlining: cost=" << InlineCost 1480a81aac4b46eed130d20714af5a1c01b05d0275eBill Wendling << ", Call: " << *CS.getInstruction(); 149fd93908ae8b9684fe71c239e3c6cfe13ff6a2663Misha Brukman 150befa499d45ffcc32bd9902518aec18589464e47cChris Lattner // Attempt to inline the function... 151ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner if (InlineCallIfPossible(CS, CG, SCCFunctions, 152ff2dad312883e5da91fb9f4e3619b7d095867f3bChris Lattner getAnalysis<TargetData>())) { 15308ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner // Remove this call site from the list. If possible, use 15408ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner // swap/pop_back for efficiency, but do not use it if doing so would 15508ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner // move a call site to a function in this SCC before the 15608ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner // 'FirstCallInSCC' barrier. 15708ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner if (SCC.size() == 1) { 15808ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner std::swap(CallSites[CSi], CallSites.back()); 15908ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner CallSites.pop_back(); 16008ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner } else { 16108ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner CallSites.erase(CallSites.begin()+CSi); 16208ff1480ffcb22e946c7bb6c7d66c5d977ae3d6eChris Lattner } 163befa499d45ffcc32bd9902518aec18589464e47cChris Lattner --CSi; 164befa499d45ffcc32bd9902518aec18589464e47cChris Lattner 165befa499d45ffcc32bd9902518aec18589464e47cChris Lattner ++NumInlined; 166befa499d45ffcc32bd9902518aec18589464e47cChris Lattner Changed = true; 167befa499d45ffcc32bd9902518aec18589464e47cChris Lattner LocalChange = true; 168775cbdd51a3b33dd5eb343689f65ab5cc8ac7118Chris Lattner } 169237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner } 170237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner } 171befa499d45ffcc32bd9902518aec18589464e47cChris Lattner } while (LocalChange); 172237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner 173775cbdd51a3b33dd5eb343689f65ab5cc8ac7118Chris Lattner return Changed; 174237ef567f6764f24a47c63121cc0a599ddc8f56dChris Lattner} 175d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 17668d57e7ae80044401efd889270a12c71b3efb9abChris Lattner// doFinalization - Remove now-dead linkonce functions at the end of 17768d57e7ae80044401efd889270a12c71b3efb9abChris Lattner// processing to avoid breaking the SCC traversal. 17868d57e7ae80044401efd889270a12c71b3efb9abChris Lattnerbool Inliner::doFinalization(CallGraph &CG) { 1793e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner std::set<CallGraphNode*> FunctionsToRemove; 1803e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner 1813e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner // Scan for all of the functions, looking for ones that should now be removed 1823e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner // from the program. Insert the dead ones in the FunctionsToRemove set. 1833e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner for (CallGraph::iterator I = CG.begin(), E = CG.end(); I != E; ++I) { 1843e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner CallGraphNode *CGN = I->second; 18554970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner if (Function *F = CGN ? CGN->getFunction() : 0) { 1860c0aa711b8a0550c21f032125c4663ff45864f81Chris Lattner // If the only remaining users of the function are dead constants, remove 1870c0aa711b8a0550c21f032125c4663ff45864f81Chris Lattner // them. 18854970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner F->removeDeadConstantUsers(); 18954970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner 19054970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner if ((F->hasLinkOnceLinkage() || F->hasInternalLinkage()) && 19154970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner F->use_empty()) { 1920c0aa711b8a0550c21f032125c4663ff45864f81Chris Lattner 19354970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner // Remove any call graph edges from the function to its callees. 194cb406c25973b4e88a6c10ad839ef1beeb3664715Dan Gohman while (!CGN->empty()) 195d85340f4ec587e22b0239617f3b747a6df113894Chris Lattner CGN->removeCallEdgeTo((CGN->end()-1)->second); 196fd93908ae8b9684fe71c239e3c6cfe13ff6a2663Misha Brukman 1970c0aa711b8a0550c21f032125c4663ff45864f81Chris Lattner // Remove any edges from the external node to the function's call graph 1980c0aa711b8a0550c21f032125c4663ff45864f81Chris Lattner // node. These edges might have been made irrelegant due to 1990c0aa711b8a0550c21f032125c4663ff45864f81Chris Lattner // optimization of the program. 2000c0aa711b8a0550c21f032125c4663ff45864f81Chris Lattner CG.getExternalCallingNode()->removeAnyCallEdgeTo(CGN); 201fd93908ae8b9684fe71c239e3c6cfe13ff6a2663Misha Brukman 20254970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner // Removing the node for callee from the call graph and delete it. 20354970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner FunctionsToRemove.insert(CGN); 20454970c032815edadb1b2988ea33f5a1173e5b29cChris Lattner } 20568d57e7ae80044401efd889270a12c71b3efb9abChris Lattner } 20668d57e7ae80044401efd889270a12c71b3efb9abChris Lattner } 2073e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner 2083e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner // Now that we know which functions to delete, do so. We didn't want to do 2093e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner // this inline, because that would invalidate our CallGraph::iterator 2103e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner // objects. :( 2113e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner bool Changed = false; 2123e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner for (std::set<CallGraphNode*>::iterator I = FunctionsToRemove.begin(), 2133e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner E = FunctionsToRemove.end(); I != E; ++I) { 2143e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner delete CG.removeFunctionFromModule(*I); 2153e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner ++NumDeleted; 2163e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner Changed = true; 2173e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner } 2183e1358a9fa1ebd3f51c94eb69da55d693895fe7cChris Lattner 21968d57e7ae80044401efd889270a12c71b3efb9abChris Lattner return Changed; 22068d57e7ae80044401efd889270a12c71b3efb9abChris Lattner} 221