• Home
  • Raw
  • Download

Lines Matching refs:CI

235       CallInst *CI = dyn_cast<CallInst>(&I);  in markTails()  local
236 if (!CI || CI->isTailCall()) in markTails()
239 bool IsNoTail = CI->isNoTailCall(); in markTails()
241 if (!IsNoTail && CI->doesNotAccessMemory()) { in markTails()
250 for (auto &Arg : CI->arg_operands()) { in markTails()
261 F.getContext(), "tailcallelim", F, CI->getDebugLoc(), in markTails()
263 CI->setTailCall(); in markTails()
269 if (!IsNoTail && Escaped == UNESCAPED && !Tracker.AllocaUsers.count(CI)) { in markTails()
270 DeferredTails.push_back(CI); in markTails()
303 for (CallInst *CI : DeferredTails) { in markTails()
304 if (Visited[CI->getParent()] != ESCAPED) { in markTails()
308 CI->getDebugLoc(), in markTails()
310 CI->setTailCall(); in markTails()
324 static bool canMoveAboveCall(Instruction *I, CallInst *CI) { in canMoveAboveCall() argument
332 if (CI->mayHaveSideEffects()) { in canMoveAboveCall()
338 if (CI->mayWriteToMemory() || in canMoveAboveCall()
350 return std::find(I->op_begin(), I->op_end(), CI) == I->op_end(); in canMoveAboveCall()
358 static bool isDynamicConstant(Value *V, CallInst *CI, ReturnInst *RI) { in isDynamicConstant() argument
366 Function *F = CI->getParent()->getParent(); in isDynamicConstant()
373 if (CI->getArgOperand(ArgNo) == Arg) in isDynamicConstant()
392 static Value *getCommonReturnValue(ReturnInst *IgnoreRI, CallInst *CI) { in getCommonReturnValue() argument
393 Function *F = CI->getParent()->getParent(); in getCommonReturnValue()
405 if (!isDynamicConstant(RetOp, CI, RI)) in getCommonReturnValue()
418 static Value *canTransformAccumulatorRecursion(Instruction *I, CallInst *CI) { in canTransformAccumulatorRecursion() argument
424 if ((I->getOperand(0) == CI && I->getOperand(1) == CI) || in canTransformAccumulatorRecursion()
425 (I->getOperand(0) != CI && I->getOperand(1) != CI)) in canTransformAccumulatorRecursion()
435 return getCommonReturnValue(cast<ReturnInst>(I->user_back()), CI); in canTransformAccumulatorRecursion()
455 CallInst *CI = nullptr; in findTRECandidate() local
458 CI = dyn_cast<CallInst>(BBI); in findTRECandidate()
459 if (CI && CI->getCalledFunction() == F) in findTRECandidate()
469 if (CI->isTailCall() && CannotTailCallElimCallsMarkedTail) in findTRECandidate()
477 firstNonDbg(BB->front().getIterator()) == CI && in findTRECandidate()
478 firstNonDbg(std::next(BB->begin())) == TI && CI->getCalledFunction() && in findTRECandidate()
479 !TTI->isLoweredToCall(CI->getCalledFunction())) { in findTRECandidate()
482 CallSite::arg_iterator I = CallSite(CI).arg_begin(), in findTRECandidate()
483 E = CallSite(CI).arg_end(); in findTRECandidate()
492 return CI; in findTRECandidate()
495 static bool eliminateRecursiveTailCall(CallInst *CI, ReturnInst *Ret, in eliminateRecursiveTailCall() argument
517 BasicBlock::iterator BBI(CI); in eliminateRecursiveTailCall()
519 if (canMoveAboveCall(&*BBI, CI)) continue; in eliminateRecursiveTailCall()
526 canTransformAccumulatorRecursion(&*BBI, CI))) { in eliminateRecursiveTailCall()
539 if (Ret->getNumOperands() == 1 && Ret->getReturnValue() != CI && in eliminateRecursiveTailCall()
542 !getCommonReturnValue(nullptr, CI)) { in eliminateRecursiveTailCall()
546 if (!isDynamicConstant(Ret->getReturnValue(), CI, Ret)) in eliminateRecursiveTailCall()
550 AccumulatorRecursionEliminationInitVal = getCommonReturnValue(Ret, CI); in eliminateRecursiveTailCall()
558 emitOptimizationRemark(F->getContext(), "tailcallelim", *F, CI->getDebugLoc(), in eliminateRecursiveTailCall()
572 TailCallsAreMarkedTail = CI->isTailCall(); in eliminateRecursiveTailCall()
602 if (TailCallsAreMarkedTail && !CI->isTailCall()) in eliminateRecursiveTailCall()
608 for (unsigned i = 0, e = CI->getNumArgOperands(); i != e; ++i) in eliminateRecursiveTailCall()
609 ArgumentPHIs[i]->addIncoming(CI->getArgOperand(i), BB); in eliminateRecursiveTailCall()
646 AccRecInstr->setOperand(AccRecInstr->getOperand(0) != CI, AccPN); in eliminateRecursiveTailCall()
665 NewBI->setDebugLoc(CI->getDebugLoc()); in eliminateRecursiveTailCall()
668 BB->getInstList().erase(CI); // Remove call. in eliminateRecursiveTailCall()
697 if (CallInst *CI = findTRECandidate(BI, CannotTailCallElimCallsMarkedTail, TTI)){ in foldReturnAndProcessPred() local
709 eliminateRecursiveTailCall(CI, RI, OldEntry, TailCallsAreMarkedTail, in foldReturnAndProcessPred()
725 CallInst *CI = findTRECandidate(Ret, CannotTailCallElimCallsMarkedTail, TTI); in processReturningBlock() local
726 if (!CI) in processReturningBlock()
729 return eliminateRecursiveTailCall(CI, Ret, OldEntry, TailCallsAreMarkedTail, in processReturningBlock()