blob: 584deacaff1bdbaec5dde62d5211f2a687d98273 [file] [log] [blame]
Chris Lattner2a365452010-08-26 01:13:54 +00001//===-- StructRetPromotion.cpp - Promote sret arguments -------------------===//
Devang Patelca891ec2008-02-29 23:34:08 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Gordon Henriksena8a118b2008-05-08 17:46:35 +000010// This pass finds functions that return a struct (using a pointer to the struct
11// as the first argument of the function, marked with the 'sret' attribute) and
12// replaces them with a new function that simply returns each of the elements of
13// that struct (using multiple return values).
14//
15// This pass works under a number of conditions:
16// 1. The returned struct must not contain other structs
17// 2. The returned struct must only be used to load values from
18// 3. The placeholder struct passed in is the result of an alloca
19//
Devang Patelca891ec2008-02-29 23:34:08 +000020//===----------------------------------------------------------------------===//
21
22#define DEBUG_TYPE "sretpromotion"
23#include "llvm/Transforms/IPO.h"
24#include "llvm/Constants.h"
25#include "llvm/DerivedTypes.h"
Owen Anderson14ce9ef2009-07-06 01:34:54 +000026#include "llvm/LLVMContext.h"
Devang Patelca891ec2008-02-29 23:34:08 +000027#include "llvm/Module.h"
28#include "llvm/CallGraphSCCPass.h"
29#include "llvm/Instructions.h"
30#include "llvm/Analysis/CallGraph.h"
31#include "llvm/Support/CallSite.h"
32#include "llvm/Support/CFG.h"
33#include "llvm/Support/Debug.h"
34#include "llvm/ADT/Statistic.h"
35#include "llvm/ADT/SmallVector.h"
Devang Patel98a6e062008-03-04 17:44:37 +000036#include "llvm/ADT/Statistic.h"
Daniel Dunbar460f6562009-07-26 09:48:23 +000037#include "llvm/Support/raw_ostream.h"
Devang Patelca891ec2008-02-29 23:34:08 +000038using namespace llvm;
39
Devang Patel98a6e062008-03-04 17:44:37 +000040STATISTIC(NumRejectedSRETUses , "Number of sret rejected due to unexpected uses");
41STATISTIC(NumSRET , "Number of sret promoted");
Devang Patelca891ec2008-02-29 23:34:08 +000042namespace {
43 /// SRETPromotion - This pass removes sret parameter and updates
44 /// function to use multiple return value.
45 ///
Nick Lewycky6726b6d2009-10-25 06:33:48 +000046 struct SRETPromotion : public CallGraphSCCPass {
Devang Patelca891ec2008-02-29 23:34:08 +000047 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
48 CallGraphSCCPass::getAnalysisUsage(AU);
49 }
50
Chris Lattner2decb222010-04-16 22:42:17 +000051 virtual bool runOnSCC(CallGraphSCC &SCC);
Devang Patelca891ec2008-02-29 23:34:08 +000052 static char ID; // Pass identification, replacement for typeid
Owen Anderson081c34b2010-10-19 17:21:58 +000053 SRETPromotion() : CallGraphSCCPass(ID) {
54 initializeSRETPromotionPass(*PassRegistry::getPassRegistry());
55 }
Devang Patelca891ec2008-02-29 23:34:08 +000056
57 private:
Chris Lattner5095e3d2009-08-31 00:19:58 +000058 CallGraphNode *PromoteReturn(CallGraphNode *CGN);
Devang Patelca891ec2008-02-29 23:34:08 +000059 bool isSafeToUpdateAllCallers(Function *F);
60 Function *cloneFunctionBody(Function *F, const StructType *STy);
Chris Lattner5095e3d2009-08-31 00:19:58 +000061 CallGraphNode *updateCallSites(Function *F, Function *NF);
Devang Patelca891ec2008-02-29 23:34:08 +000062 };
Devang Patelca891ec2008-02-29 23:34:08 +000063}
64
Dan Gohman844731a2008-05-13 00:00:25 +000065char SRETPromotion::ID = 0;
Owen Andersonae0a7bc2010-10-13 22:00:45 +000066INITIALIZE_PASS_BEGIN(SRETPromotion, "sretpromotion",
67 "Promote sret arguments to multiple ret values", false, false)
68INITIALIZE_AG_DEPENDENCY(CallGraph)
69INITIALIZE_PASS_END(SRETPromotion, "sretpromotion",
Owen Andersonce665bd2010-10-07 22:25:06 +000070 "Promote sret arguments to multiple ret values", false, false)
Dan Gohman844731a2008-05-13 00:00:25 +000071
Devang Patelca891ec2008-02-29 23:34:08 +000072Pass *llvm::createStructRetPromotionPass() {
73 return new SRETPromotion();
74}
75
Chris Lattner2decb222010-04-16 22:42:17 +000076bool SRETPromotion::runOnSCC(CallGraphSCC &SCC) {
Devang Patelca891ec2008-02-29 23:34:08 +000077 bool Changed = false;
78
Chris Lattner2decb222010-04-16 22:42:17 +000079 for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I)
80 if (CallGraphNode *NewNode = PromoteReturn(*I)) {
81 SCC.ReplaceNode(*I, NewNode);
Chris Lattner5095e3d2009-08-31 00:19:58 +000082 Changed = true;
83 }
Devang Patelca891ec2008-02-29 23:34:08 +000084
85 return Changed;
86}
87
88/// PromoteReturn - This method promotes function that uses StructRet paramater
Chris Lattner5095e3d2009-08-31 00:19:58 +000089/// into a function that uses multiple return values.
90CallGraphNode *SRETPromotion::PromoteReturn(CallGraphNode *CGN) {
Devang Patelca891ec2008-02-29 23:34:08 +000091 Function *F = CGN->getFunction();
92
Rafael Espindolabb46f522009-01-15 20:18:42 +000093 if (!F || F->isDeclaration() || !F->hasLocalLinkage())
Chris Lattner5095e3d2009-08-31 00:19:58 +000094 return 0;
Devang Patelca891ec2008-02-29 23:34:08 +000095
96 // Make sure that function returns struct.
Devang Patel41e23972008-03-03 21:46:28 +000097 if (F->arg_size() == 0 || !F->hasStructRetAttr() || F->doesNotReturn())
Chris Lattner5095e3d2009-08-31 00:19:58 +000098 return 0;
Devang Patelca891ec2008-02-29 23:34:08 +000099
David Greene09d70db2010-01-05 01:27:54 +0000100 DEBUG(dbgs() << "SretPromotion: Looking at sret function "
Daniel Dunbar460f6562009-07-26 09:48:23 +0000101 << F->getName() << "\n");
Matthijs Kooijman81ec2482008-08-07 15:14:04 +0000102
Benjamin Kramerf0127052010-01-05 13:12:22 +0000103 assert(F->getReturnType()->isVoidTy() && "Invalid function return type");
Devang Patelca891ec2008-02-29 23:34:08 +0000104 Function::arg_iterator AI = F->arg_begin();
105 const llvm::PointerType *FArgType = dyn_cast<PointerType>(AI->getType());
Chris Lattner5095e3d2009-08-31 00:19:58 +0000106 assert(FArgType && "Invalid sret parameter type");
Devang Patelca891ec2008-02-29 23:34:08 +0000107 const llvm::StructType *STy =
108 dyn_cast<StructType>(FArgType->getElementType());
Chris Lattner5095e3d2009-08-31 00:19:58 +0000109 assert(STy && "Invalid sret parameter element type");
Devang Patelca891ec2008-02-29 23:34:08 +0000110
111 // Check if it is ok to perform this promotion.
Devang Patel98a6e062008-03-04 17:44:37 +0000112 if (isSafeToUpdateAllCallers(F) == false) {
David Greene09d70db2010-01-05 01:27:54 +0000113 DEBUG(dbgs() << "SretPromotion: Not all callers can be updated\n");
Dan Gohmanfe601042010-06-22 15:08:57 +0000114 ++NumRejectedSRETUses;
Chris Lattner5095e3d2009-08-31 00:19:58 +0000115 return 0;
Devang Patel98a6e062008-03-04 17:44:37 +0000116 }
Devang Patelca891ec2008-02-29 23:34:08 +0000117
David Greene09d70db2010-01-05 01:27:54 +0000118 DEBUG(dbgs() << "SretPromotion: sret argument will be promoted\n");
Dan Gohmanfe601042010-06-22 15:08:57 +0000119 ++NumSRET;
Devang Patelca891ec2008-02-29 23:34:08 +0000120 // [1] Replace use of sret parameter
Owen Anderson50dead02009-07-15 23:53:25 +0000121 AllocaInst *TheAlloca = new AllocaInst(STy, NULL, "mrv",
122 F->getEntryBlock().begin());
Devang Patelca891ec2008-02-29 23:34:08 +0000123 Value *NFirstArg = F->arg_begin();
124 NFirstArg->replaceAllUsesWith(TheAlloca);
125
Devang Patel98a6e062008-03-04 17:44:37 +0000126 // [2] Find and replace ret instructions
Devang Patelca891ec2008-02-29 23:34:08 +0000127 for (Function::iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI)
128 for(BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE; ) {
129 Instruction *I = BI;
130 ++BI;
131 if (isa<ReturnInst>(I)) {
Dan Gohmanfc74abf2008-07-23 00:34:11 +0000132 Value *NV = new LoadInst(TheAlloca, "mrv.ld", I);
Owen Anderson1d0be152009-08-13 21:58:54 +0000133 ReturnInst *NR = ReturnInst::Create(F->getContext(), NV, I);
Devang Patelca891ec2008-02-29 23:34:08 +0000134 I->replaceAllUsesWith(NR);
135 I->eraseFromParent();
136 }
137 }
138
Devang Patel98a6e062008-03-04 17:44:37 +0000139 // [3] Create the new function body and insert it into the module.
Devang Patelca891ec2008-02-29 23:34:08 +0000140 Function *NF = cloneFunctionBody(F, STy);
141
Devang Patel98a6e062008-03-04 17:44:37 +0000142 // [4] Update all call sites to use new function
Chris Lattner5095e3d2009-08-31 00:19:58 +0000143 CallGraphNode *NF_CFN = updateCallSites(F, NF);
Devang Patelca891ec2008-02-29 23:34:08 +0000144
Chris Lattner5095e3d2009-08-31 00:19:58 +0000145 CallGraph &CG = getAnalysis<CallGraph>();
146 NF_CFN->stealCalledFunctionsFrom(CG[F]);
147
148 delete CG.removeFunctionFromModule(F);
149 return NF_CFN;
Devang Patelca891ec2008-02-29 23:34:08 +0000150}
151
Duncan Sands33af59d2008-05-09 12:20:10 +0000152// Check if it is ok to perform this promotion.
Devang Patelca891ec2008-02-29 23:34:08 +0000153bool SRETPromotion::isSafeToUpdateAllCallers(Function *F) {
154
155 if (F->use_empty())
156 // No users. OK to modify signature.
157 return true;
158
159 for (Value::use_iterator FnUseI = F->use_begin(), FnUseE = F->use_end();
160 FnUseI != FnUseE; ++FnUseI) {
Matthijs Kooijman257da0a2008-06-05 08:48:32 +0000161 // The function is passed in as an argument to (possibly) another function,
162 // we can't change it!
Gabor Greif7d3056b2010-07-28 22:50:26 +0000163 CallSite CS(*FnUseI);
Devang Patelca891ec2008-02-29 23:34:08 +0000164 Instruction *Call = CS.getInstruction();
Matthijs Kooijman47c6fd72008-06-05 08:57:20 +0000165 // The function is used by something else than a call or invoke instruction,
166 // we can't change it!
Gabor Greifedc4d692009-01-22 21:35:57 +0000167 if (!Call || !CS.isCallee(FnUseI))
Matthijs Kooijman47c6fd72008-06-05 08:57:20 +0000168 return false;
Devang Patelca891ec2008-02-29 23:34:08 +0000169 CallSite::arg_iterator AI = CS.arg_begin();
170 Value *FirstArg = *AI;
171
172 if (!isa<AllocaInst>(FirstArg))
173 return false;
174
175 // Check FirstArg's users.
176 for (Value::use_iterator ArgI = FirstArg->use_begin(),
177 ArgE = FirstArg->use_end(); ArgI != ArgE; ++ArgI) {
Gabor Greiffc41f902010-07-12 11:19:24 +0000178 User *U = *ArgI;
Devang Patelca891ec2008-02-29 23:34:08 +0000179 // If FirstArg user is a CallInst that does not correspond to current
180 // call site then this function F is not suitable for sret promotion.
Gabor Greiffc41f902010-07-12 11:19:24 +0000181 if (CallInst *CI = dyn_cast<CallInst>(U)) {
Devang Patelca891ec2008-02-29 23:34:08 +0000182 if (CI != Call)
183 return false;
184 }
185 // If FirstArg user is a GEP whose all users are not LoadInst then
186 // this function F is not suitable for sret promotion.
Gabor Greiffc41f902010-07-12 11:19:24 +0000187 else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(U)) {
Devang Patele0a6a3f2008-03-05 23:39:23 +0000188 // TODO : Use dom info and insert PHINodes to collect get results
189 // from multiple call sites for this GEP.
190 if (GEP->getParent() != Call->getParent())
191 return false;
Devang Patelca891ec2008-02-29 23:34:08 +0000192 for (Value::use_iterator GEPI = GEP->use_begin(), GEPE = GEP->use_end();
193 GEPI != GEPE; ++GEPI)
Gabor Greif96f1d8e2010-07-22 13:36:47 +0000194 if (!isa<LoadInst>(*GEPI))
Devang Patelca891ec2008-02-29 23:34:08 +0000195 return false;
196 }
197 // Any other FirstArg users make this function unsuitable for sret
198 // promotion.
199 else
200 return false;
201 }
202 }
203
204 return true;
205}
206
207/// cloneFunctionBody - Create a new function based on F and
208/// insert it into module. Remove first argument. Use STy as
209/// the return type for new function.
210Function *SRETPromotion::cloneFunctionBody(Function *F,
211 const StructType *STy) {
212
Devang Patelca891ec2008-02-29 23:34:08 +0000213 const FunctionType *FTy = F->getFunctionType();
214 std::vector<const Type*> Params;
215
Devang Patel05988662008-09-25 21:00:45 +0000216 // Attributes - Keep track of the parameter attributes for the arguments.
217 SmallVector<AttributeWithIndex, 8> AttributesVec;
218 const AttrListPtr &PAL = F->getAttributes();
Devang Patel2a4821b2008-03-03 18:36:03 +0000219
220 // Add any return attributes.
Devang Patel19c87462008-09-26 22:53:05 +0000221 if (Attributes attrs = PAL.getRetAttributes())
Devang Patel05988662008-09-25 21:00:45 +0000222 AttributesVec.push_back(AttributeWithIndex::get(0, attrs));
Devang Patel2a4821b2008-03-03 18:36:03 +0000223
Devang Patelca891ec2008-02-29 23:34:08 +0000224 // Skip first argument.
225 Function::arg_iterator I = F->arg_begin(), E = F->arg_end();
226 ++I;
Devang Patel8f9b5512008-03-12 00:07:03 +0000227 // 0th parameter attribute is reserved for return type.
228 // 1th parameter attribute is for first 1st sret argument.
229 unsigned ParamIndex = 2;
Devang Patelca891ec2008-02-29 23:34:08 +0000230 while (I != E) {
231 Params.push_back(I->getType());
Devang Patel19c87462008-09-26 22:53:05 +0000232 if (Attributes Attrs = PAL.getParamAttributes(ParamIndex))
Devang Patel05988662008-09-25 21:00:45 +0000233 AttributesVec.push_back(AttributeWithIndex::get(ParamIndex - 1, Attrs));
Devang Patelca891ec2008-02-29 23:34:08 +0000234 ++I;
Devang Patel2a4821b2008-03-03 18:36:03 +0000235 ++ParamIndex;
Devang Patelca891ec2008-02-29 23:34:08 +0000236 }
237
Devang Patel19c87462008-09-26 22:53:05 +0000238 // Add any fn attributes.
239 if (Attributes attrs = PAL.getFnAttributes())
240 AttributesVec.push_back(AttributeWithIndex::get(~0, attrs));
241
242
Owen Andersondebcb012009-07-29 22:17:13 +0000243 FunctionType *NFTy = FunctionType::get(STy, Params, FTy->isVarArg());
Matthijs Kooijman7d942002008-08-07 16:01:23 +0000244 Function *NF = Function::Create(NFTy, F->getLinkage());
245 NF->takeName(F);
Duncan Sands28c3cff2008-05-26 19:58:59 +0000246 NF->copyAttributesFrom(F);
Devang Patel05988662008-09-25 21:00:45 +0000247 NF->setAttributes(AttrListPtr::get(AttributesVec.begin(), AttributesVec.end()));
Devang Patelca891ec2008-02-29 23:34:08 +0000248 F->getParent()->getFunctionList().insert(F, NF);
249 NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList());
250
251 // Replace arguments
252 I = F->arg_begin();
253 E = F->arg_end();
254 Function::arg_iterator NI = NF->arg_begin();
255 ++I;
256 while (I != E) {
Chris Lattner5095e3d2009-08-31 00:19:58 +0000257 I->replaceAllUsesWith(NI);
258 NI->takeName(I);
259 ++I;
260 ++NI;
Devang Patelca891ec2008-02-29 23:34:08 +0000261 }
262
263 return NF;
264}
265
266/// updateCallSites - Update all sites that call F to use NF.
Chris Lattner5095e3d2009-08-31 00:19:58 +0000267CallGraphNode *SRETPromotion::updateCallSites(Function *F, Function *NF) {
Duncan Sandsa9c32512008-09-08 11:08:09 +0000268 CallGraph &CG = getAnalysis<CallGraph>();
Devang Patelca891ec2008-02-29 23:34:08 +0000269 SmallVector<Value*, 16> Args;
270
Devang Patel05988662008-09-25 21:00:45 +0000271 // Attributes - Keep track of the parameter attributes for the arguments.
272 SmallVector<AttributeWithIndex, 8> ArgAttrsVec;
Devang Patel2a4821b2008-03-03 18:36:03 +0000273
Chris Lattner5095e3d2009-08-31 00:19:58 +0000274 // Get a new callgraph node for NF.
275 CallGraphNode *NF_CGN = CG.getOrInsertFunction(NF);
276
Matthijs Kooijmanc1f1d462008-08-14 15:03:05 +0000277 while (!F->use_empty()) {
Gabor Greif7d3056b2010-07-28 22:50:26 +0000278 CallSite CS(*F->use_begin());
Devang Patelca891ec2008-02-29 23:34:08 +0000279 Instruction *Call = CS.getInstruction();
280
Devang Patel05988662008-09-25 21:00:45 +0000281 const AttrListPtr &PAL = F->getAttributes();
Devang Patel2a4821b2008-03-03 18:36:03 +0000282 // Add any return attributes.
Devang Patel19c87462008-09-26 22:53:05 +0000283 if (Attributes attrs = PAL.getRetAttributes())
Devang Patel05988662008-09-25 21:00:45 +0000284 ArgAttrsVec.push_back(AttributeWithIndex::get(0, attrs));
Devang Patel2a4821b2008-03-03 18:36:03 +0000285
Devang Patelca891ec2008-02-29 23:34:08 +0000286 // Copy arguments, however skip first one.
287 CallSite::arg_iterator AI = CS.arg_begin(), AE = CS.arg_end();
288 Value *FirstCArg = *AI;
289 ++AI;
Devang Patel8f9b5512008-03-12 00:07:03 +0000290 // 0th parameter attribute is reserved for return type.
291 // 1th parameter attribute is for first 1st sret argument.
292 unsigned ParamIndex = 2;
Devang Patelca891ec2008-02-29 23:34:08 +0000293 while (AI != AE) {
294 Args.push_back(*AI);
Devang Patel19c87462008-09-26 22:53:05 +0000295 if (Attributes Attrs = PAL.getParamAttributes(ParamIndex))
Devang Patel05988662008-09-25 21:00:45 +0000296 ArgAttrsVec.push_back(AttributeWithIndex::get(ParamIndex - 1, Attrs));
Devang Patel2a4821b2008-03-03 18:36:03 +0000297 ++ParamIndex;
Devang Patelca891ec2008-02-29 23:34:08 +0000298 ++AI;
299 }
300
Devang Patel19c87462008-09-26 22:53:05 +0000301 // Add any function attributes.
302 if (Attributes attrs = PAL.getFnAttributes())
303 ArgAttrsVec.push_back(AttributeWithIndex::get(~0, attrs));
Chris Lattner58d74912008-03-12 17:45:29 +0000304
Devang Patel05988662008-09-25 21:00:45 +0000305 AttrListPtr NewPAL = AttrListPtr::get(ArgAttrsVec.begin(), ArgAttrsVec.end());
Chris Lattner58d74912008-03-12 17:45:29 +0000306
Devang Patelca891ec2008-02-29 23:34:08 +0000307 // Build new call instruction.
308 Instruction *New;
309 if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
Gabor Greif051a9502008-04-06 20:25:17 +0000310 New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
311 Args.begin(), Args.end(), "", Call);
Devang Patelca891ec2008-02-29 23:34:08 +0000312 cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
Devang Patel05988662008-09-25 21:00:45 +0000313 cast<InvokeInst>(New)->setAttributes(NewPAL);
Devang Patelca891ec2008-02-29 23:34:08 +0000314 } else {
Gabor Greif051a9502008-04-06 20:25:17 +0000315 New = CallInst::Create(NF, Args.begin(), Args.end(), "", Call);
Devang Patelca891ec2008-02-29 23:34:08 +0000316 cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
Devang Patel05988662008-09-25 21:00:45 +0000317 cast<CallInst>(New)->setAttributes(NewPAL);
Devang Patelca891ec2008-02-29 23:34:08 +0000318 if (cast<CallInst>(Call)->isTailCall())
319 cast<CallInst>(New)->setTailCall();
320 }
321 Args.clear();
Devang Patel544b92b2008-03-04 19:12:58 +0000322 ArgAttrsVec.clear();
Devang Patelca891ec2008-02-29 23:34:08 +0000323 New->takeName(Call);
324
Duncan Sandsa9c32512008-09-08 11:08:09 +0000325 // Update the callgraph to know that the callsite has been transformed.
Chris Lattnerda230cb2009-09-01 18:52:39 +0000326 CallGraphNode *CalleeNode = CG[Call->getParent()->getParent()];
327 CalleeNode->removeCallEdgeFor(Call);
328 CalleeNode->addCalledFunction(New, NF_CGN);
Chris Lattner7c8c1ba2009-09-01 18:50:55 +0000329
Dan Gohmanfc74abf2008-07-23 00:34:11 +0000330 // Update all users of sret parameter to extract value using extractvalue.
Devang Patelca891ec2008-02-29 23:34:08 +0000331 for (Value::use_iterator UI = FirstCArg->use_begin(),
332 UE = FirstCArg->use_end(); UI != UE; ) {
333 User *U2 = *UI++;
334 CallInst *C2 = dyn_cast<CallInst>(U2);
335 if (C2 && (C2 == Call))
336 continue;
Chris Lattner5095e3d2009-08-31 00:19:58 +0000337
Chris Lattner7c8c1ba2009-09-01 18:50:55 +0000338 GetElementPtrInst *UGEP = cast<GetElementPtrInst>(U2);
339 ConstantInt *Idx = cast<ConstantInt>(UGEP->getOperand(2));
340 Value *GR = ExtractValueInst::Create(New, Idx->getZExtValue(),
341 "evi", UGEP);
342 while(!UGEP->use_empty()) {
343 // isSafeToUpdateAllCallers has checked that all GEP uses are
344 // LoadInsts
345 LoadInst *L = cast<LoadInst>(*UGEP->use_begin());
346 L->replaceAllUsesWith(GR);
347 L->eraseFromParent();
Devang Patelca891ec2008-02-29 23:34:08 +0000348 }
Chris Lattner7c8c1ba2009-09-01 18:50:55 +0000349 UGEP->eraseFromParent();
350 continue;
Devang Patelca891ec2008-02-29 23:34:08 +0000351 }
352 Call->eraseFromParent();
353 }
Chris Lattner5095e3d2009-08-31 00:19:58 +0000354
355 return NF_CGN;
Devang Patelca891ec2008-02-29 23:34:08 +0000356}
Devang Patela9fe8bb2008-03-04 21:32:09 +0000357