Home | History | Annotate | Download | only in Scalar

Lines Matching refs:CI

92     bool EliminateRecursiveTailCall(CallInst *CI, ReturnInst *Ret,
106 bool CanMoveAboveCall(Instruction *I, CallInst *CI);
107 Value *CanTransformAccumulatorRecursion(Instruction *I, CallInst *CI);
219 if (CallInst *CI = dyn_cast<CallInst>(I)) {
220 CI->setTailCall();
232 bool TailCallElim::CanMoveAboveCall(Instruction *I, CallInst *CI) {
240 if (CI->mayHaveSideEffects()) {
245 if (CI->mayWriteToMemory() ||
258 if (I->getOperand(i) == CI)
270 static bool isDynamicConstant(Value *V, CallInst *CI, ReturnInst *RI) {
278 Function *F = CI->getParent()->getParent();
285 if (CI->getArgOperand(ArgNo) == Arg)
305 static Value *getCommonReturnValue(ReturnInst *IgnoreRI, CallInst *CI) {
306 Function *F = CI->getParent()->getParent();
318 if (!isDynamicConstant(RetOp, CI, RI))
333 CallInst *CI) {
339 if ((I->getOperand(0) == CI && I->getOperand(1) == CI) ||
340 (I->getOperand(0) != CI && I->getOperand(1) != CI))
350 return getCommonReturnValue(cast<ReturnInst>(I->use_back()), CI);
369 // this block. If so, set CI to it.
370 CallInst *CI = 0;
373 CI = dyn_cast<CallInst>(BBI);
374 if (CI && CI->getCalledFunction() == F)
384 if (CI->isTailCall() && CannotTailCallElimCallsMarkedTail)
392 FirstNonDbg(BB->front()) == CI &&
397 CallSite::arg_iterator I = CallSite(CI).arg_begin(),
398 E = CallSite(CI).arg_end();
407 return CI;
410 bool TailCallElim::EliminateRecursiveTailCall(CallInst *CI, ReturnInst *Ret,
432 BasicBlock::iterator BBI = CI;
434 if (CanMoveAboveCall(BBI, CI)) continue;
441 CanTransformAccumulatorRecursion(BBI, CI))) {
454 if (Ret->getNumOperands() == 1 && Ret->getReturnValue() != CI &&
457 !getCommonReturnValue(0, CI)) {
461 if (!isDynamicConstant(Ret->getReturnValue(), CI, Ret))
465 AccumulatorRecursionEliminationInitVal = getCommonReturnValue(Ret, CI);
484 TailCallsAreMarkedTail = CI->isTailCall();
514 if (TailCallsAreMarkedTail && !CI->isTailCall())
520 for (unsigned i = 0, e = CI->getNumArgOperands(); i != e; ++i)
521 ArgumentPHIs[i]->addIncoming(CI->getArgOperand(i), BB);
559 AccRecInstr->setOperand(AccRecInstr->getOperand(0) != CI, AccPN);
578 NewBI->setDebugLoc(CI->getDebugLoc());
581 BB->getInstList().erase(CI); // Remove call.
609 if (CallInst *CI = FindTRECandidate(BI, CannotTailCallElimCallsMarkedTail)){
612 EliminateRecursiveTailCall(CI, FoldReturnIntoUncondBranch(Ret, BB, Pred),
627 CallInst *CI = FindTRECandidate(Ret, CannotTailCallElimCallsMarkedTail);
628 if (!CI)
631 return EliminateRecursiveTailCall(CI, Ret, OldEntry, TailCallsAreMarkedTail,