Lines Matching refs:TI

160   Instruction *TI = nullptr;
165 Instruction *TI, ArrayRef<Value *> Invariants,
168 : TI(TI), Invariants(Invariants), Cost(Cost),
771 auto *TI = BBToCheck.getTerminator();
772 bool isUnreachable = isa<UnreachableInst>(TI);
774 (isUnreachable && (BBToCheck.getFirstNonPHIOrDbg() != TI));
2177 Loop &L, Instruction &TI, ArrayRef<Value *> Invariants,
2181 auto *ParentBB = TI.getParent();
2182 BranchInst *BI = dyn_cast<BranchInst>(&TI);
2183 SwitchInst *SI = BI ? nullptr : cast<SwitchInst>(&TI);
2329 if (TI.getMetadata(LLVMContext::MD_make_implicit)) {
2333 TI.setMetadata(LLVMContext::MD_make_implicit, nullptr);
2339 if (!SafetyInfo.isGuaranteedToExecute(TI, &DT, &L))
2340 TI.setMetadata(LLVMContext::MD_make_implicit, nullptr);
2350 Instruction *NewTI = TI.clone();
2355 TI.moveBefore(*SplitBB, SplitBB->end());
2356 TI.dropLocation();
2366 // BI (`dyn_cast<BranchInst>(TI)`) is an in-loop instruction hoisted
2820 const Instruction &TI, const Loop &L, const LoopInfo &LI,
2829 const BasicBlock *CondBlock = TI.getParent();
2831 (isGuard(&TI) ||
2832 (TI.isTerminator() &&
2833 llvm::count_if(successors(&TI), [&L](const BasicBlock *SuccBB) {
2848 const Instruction *CI = Candidate.TI;
2894 << " for unswitch candidate: " << TI << "\n");
2969 return TerminatorAndInvariants.TI == L.getHeader()->getTerminator();
3088 assert(LI.getLoopFor(Candidate.TI->getParent()) == &L &&
3095 auto *TI = cast<BranchInst>(Candidate.TI);
3096 auto *BB = Candidate.TI->getParent();
3097 auto *OutOfLoopSucc = InLoopSucc == TI->getSuccessor(0) ? TI->getSuccessor(1)
3098 : TI->getSuccessor(0);
3121 Builder.SetInsertPoint(TI);
3126 Builder.CreateCondBr(TI->getCondition(), TI->getSuccessor(0),
3127 TI->getSuccessor(1));
3128 TI->eraseFromParent();
3370 auto ComputeUnswitchedCost = [&](Instruction &TI,
3373 if (isa<SelectInst>(TI))
3376 BasicBlock &BB = *TI.getParent();
3391 auto &BI = cast<BranchInst>(TI);
3425 int SuccessorsCount = isGuard(&TI) ? 2 : Visited.size();
3433 Instruction &TI = *Candidate.TI;
3435 BranchInst *BI = dyn_cast<BranchInst>(&TI);
3440 InstructionCost CandidateCost = ComputeUnswitchedCost(TI, FullUnswitch);
3445 CalculateUnswitchCostMultiplier(TI, L, LI, DT, UnswitchCandidates);
3452 << " for unswitch candidate: " << TI << "\n");
3455 << " for unswitch candidate: " << TI << "\n");
3473 static bool shouldInsertFreeze(Loop &L, Instruction &TI, DominatorTree &DT,
3475 assert(isa<BranchInst>(TI) || isa<SwitchInst>(TI));
3481 if (SafetyInfo.isGuaranteedToExecute(TI, &DT, &L))
3485 if (BranchInst *BI = dyn_cast<BranchInst>(&TI))
3488 Cond = skipTrivialSelect(cast<SwitchInst>(&TI)->getCondition());
3520 assert(Best.TI && "Failed to find loop unswitch candidate");
3537 if (Best.TI != PartialIVCondBranch)
3541 if (auto *SI = dyn_cast<SelectInst>(Best.TI)) {
3548 Best.TI = turnSelectIntoBranch(SI, DT, LI, MSSAU, &AC);
3551 if (isGuard(Best.TI))
3552 Best.TI =
3553 turnGuardIntoBranch(cast<IntrinsicInst>(Best.TI), L, DT, LI, MSSAU);
3554 InsertFreeze = shouldInsertFreeze(L, *Best.TI, DT, AC);
3558 << ") terminator: " << *Best.TI << "\n");
3559 unswitchNontrivialInvariants(L, *Best.TI, Best.Invariants, PartialIVInfo, DT,