llvm.org GIT mirror llvm / 47968e4
These are legal for tail calls git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21723 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 14 years ago
2 changed file(s) with 5 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
6464 // create fib(x-1)
6565 Value *Sub = BinaryOperator::createSub(ArgX, One, "arg", RecurseBB);
6666 Value *CallFibX1 = new CallInst(FibF, Sub, "fibx1", RecurseBB);
67 CallFibX1->setTailCall(true);
6768
6869 // create fib(x-2)
6970 Sub = BinaryOperator::createSub(ArgX, Two, "arg", RecurseBB);
7071 Value *CallFibX2 = new CallInst(FibF, Sub, "fibx2", RecurseBB);
72 CallFibX2->setTailCall(true);
73
7174
7275 // fib(x-1)+fib(x-2)
7376 Value *Sum = BinaryOperator::createAdd(CallFibX1, CallFibX2,
8686 // Pass Ten to the call call:
8787 std::vector Params;
8888 Params.push_back(Ten);
89 CallInst * Add1CallRes = new CallInst(Add1F, Params, "add1", BB);
89 CallInst *Add1CallRes = new CallInst(Add1F, Params, "add1", BB);
90 Add1CallRes->setTailCall(true);
9091
9192 // Create the return instruction and add it to the basic block.
9293 new ReturnInst(Add1CallRes, BB);