Lines Matching defs:CI
99 bool EliminateRecursiveTailCall(CallInst *CI, ReturnInst *Ret,
113 bool CanMoveAboveCall(Instruction *I, CallInst *CI);
114 Value *CanTransformAccumulatorRecursion(Instruction *I, CallInst *CI);
250 if (CallInst *CI = dyn_cast<CallInst>(I)) {
251 if (!ACT.UsesAlloca.count(CI)) {
252 CI->setTailCall();
268 bool TailCallElim::CanMoveAboveCall(Instruction *I, CallInst *CI) {
276 if (CI->mayHaveSideEffects()) {
281 if (CI->mayWriteToMemory() ||
294 if (I->getOperand(i) == CI)
306 static bool isDynamicConstant(Value *V, CallInst *CI, ReturnInst *RI) {
314 Function *F = CI->getParent()->getParent();
321 if (CI->getArgOperand(ArgNo) == Arg)
341 static Value *getCommonReturnValue(ReturnInst *IgnoreRI, CallInst *CI) {
342 Function *F = CI->getParent()->getParent();
354 if (!isDynamicConstant(RetOp, CI, RI))
369 CallInst *CI) {
375 if ((I->getOperand(0) == CI && I->getOperand(1) == CI) ||
376 (I->getOperand(0) != CI && I->getOperand(1) != CI))
386 return getCommonReturnValue(cast<ReturnInst>(I->use_back()), CI);
405 // this block. If so, set CI to it.
406 CallInst *CI = 0;
409 CI = dyn_cast<CallInst>(BBI);
410 if (CI && CI->getCalledFunction() == F)
420 if (CI->isTailCall() && CannotTailCallElimCallsMarkedTail)
428 FirstNonDbg(BB->front()) == CI &&
430 CI->getCalledFunction() &&
431 !TTI->isLoweredToCall(CI->getCalledFunction())) {
434 CallSite::arg_iterator I = CallSite(CI).arg_begin(),
435 E = CallSite(CI).arg_end();
444 return CI;
447 bool TailCallElim::EliminateRecursiveTailCall(CallInst *CI, ReturnInst *Ret,
469 BasicBlock::iterator BBI = CI;
471 if (CanMoveAboveCall(BBI, CI)) continue;
478 CanTransformAccumulatorRecursion(BBI, CI))) {
491 if (Ret->getNumOperands() == 1 && Ret->getReturnValue() != CI &&
494 !getCommonReturnValue(0, CI)) {
498 if (!isDynamicConstant(Ret->getReturnValue(), CI, Ret))
502 AccumulatorRecursionEliminationInitVal = getCommonReturnValue(Ret, CI);
521 TailCallsAreMarkedTail = CI->isTailCall();
551 if (TailCallsAreMarkedTail && !CI->isTailCall())
557 for (unsigned i = 0, e = CI->getNumArgOperands(); i != e; ++i)
558 ArgumentPHIs[i]->addIncoming(CI->getArgOperand(i), BB);
596 AccRecInstr->setOperand(AccRecInstr->getOperand(0) != CI, AccPN);
615 NewBI->setDebugLoc(CI->getDebugLoc());
618 BB->getInstList().erase(CI); // Remove call.
646 if (CallInst *CI = FindTRECandidate(BI, CannotTailCallElimCallsMarkedTail)){
649 EliminateRecursiveTailCall(CI, FoldReturnIntoUncondBranch(Ret, BB, Pred),
665 CallInst *CI = FindTRECandidate(Ret, CannotTailCallElimCallsMarkedTail);
666 if (!CI)
669 return EliminateRecursiveTailCall(CI, Ret, OldEntry, TailCallsAreMarkedTail,