Lines Matching refs:PBI

2061     Instruction *PBI = &*I;  in checkCSEInPredecessor()  local
2063 if (Inst->isIdenticalTo(PBI)) { in checkCSEInPredecessor()
2064 Inst->replaceAllUsesWith(PBI); in checkCSEInPredecessor()
2087 if (BranchInst *PBI = dyn_cast<BranchInst>(PB->getTerminator())) in FoldBranchToCommonDest() local
2088 if (PBI->isConditional() && in FoldBranchToCommonDest()
2089 (BI->getSuccessor(0) == PBI->getSuccessor(0) || in FoldBranchToCommonDest()
2090 BI->getSuccessor(0) == PBI->getSuccessor(1))) { in FoldBranchToCommonDest()
2163 BranchInst *PBI = dyn_cast<BranchInst>(PredBlock->getTerminator()); in FoldBranchToCommonDest() local
2169 if (!PBI || PBI->isUnconditional() || in FoldBranchToCommonDest()
2171 !SafeToMergeTerminators(BI, PBI)) || in FoldBranchToCommonDest()
2173 !isProfitableToFoldUnconditional(BI, PBI, Cond, PHIs))) in FoldBranchToCommonDest()
2181 if (PBI->getSuccessor(0) == TrueDest) in FoldBranchToCommonDest()
2183 else if (PBI->getSuccessor(1) == FalseDest) in FoldBranchToCommonDest()
2185 else if (PBI->getSuccessor(0) == FalseDest) in FoldBranchToCommonDest()
2187 else if (PBI->getSuccessor(1) == TrueDest) in FoldBranchToCommonDest()
2192 if (PBI->getSuccessor(0) != TrueDest && PBI->getSuccessor(1) != TrueDest) in FoldBranchToCommonDest()
2196 DEBUG(dbgs() << "FOLDING BRANCH TO COMMON DEST:\n" << *PBI << *BB); in FoldBranchToCommonDest()
2197 IRBuilder<> Builder(PBI); in FoldBranchToCommonDest()
2201 Value *NewCond = PBI->getCondition(); in FoldBranchToCommonDest()
2208 PBI->getCondition()->getName()+".not"); in FoldBranchToCommonDest()
2211 PBI->setCondition(NewCond); in FoldBranchToCommonDest()
2212 PBI->swapSuccessors(); in FoldBranchToCommonDest()
2237 PredBlock->getInstList().insert(PBI->getIterator(), NewBonusInst); in FoldBranchToCommonDest()
2247 PredBlock->getInstList().insert(PBI->getIterator(), New); in FoldBranchToCommonDest()
2253 cast<Instruction>(Builder.CreateBinOp(Opc, PBI->getCondition(), in FoldBranchToCommonDest()
2255 PBI->setCondition(NewCond); in FoldBranchToCommonDest()
2258 bool PredHasWeights = ExtractBranchMetadata(PBI, PredTrueWeight, in FoldBranchToCommonDest()
2264 if (PBI->getSuccessor(0) == BB) { in FoldBranchToCommonDest()
2278 PBI->setSuccessor(0, TrueDest); in FoldBranchToCommonDest()
2280 if (PBI->getSuccessor(1) == BB) { in FoldBranchToCommonDest()
2292 PBI->setSuccessor(1, FalseDest); in FoldBranchToCommonDest()
2299 PBI->setMetadata(LLVMContext::MD_prof, in FoldBranchToCommonDest()
2303 PBI->setMetadata(LLVMContext::MD_prof, nullptr); in FoldBranchToCommonDest()
2308 PHIs[i]->getIncomingValueForBlock(PBI->getParent())); in FoldBranchToCommonDest()
2311 if (PBI->getSuccessor(0) == TrueDest) { in FoldBranchToCommonDest()
2316 cast<Instruction>(Builder.CreateNot(PBI->getCondition(), in FoldBranchToCommonDest()
2325 PBI->getCondition(), MergedCond, in FoldBranchToCommonDest()
2333 PBI->getCondition(), New, in FoldBranchToCommonDest()
2337 cast<Instruction>(Builder.CreateNot(PBI->getCondition(), in FoldBranchToCommonDest()
2346 PHIs[i]->setIncomingValue(PHIs[i]->getBasicBlockIndex(PBI->getParent()), in FoldBranchToCommonDest()
2350 BranchInst *New_PBI = BranchInst::Create(TrueDest, PBI); in FoldBranchToCommonDest()
2351 EraseTerminatorInstAndDCECond(PBI); in FoldBranchToCommonDest()
2352 PBI = New_PBI; in FoldBranchToCommonDest()
2361 I->clone()->insertBefore(PBI); in FoldBranchToCommonDest()
2553 static bool mergeConditionalStores(BranchInst *PBI, BranchInst *QBI) { in mergeConditionalStores() argument
2582 BasicBlock *PTB = PBI->getSuccessor(0); in mergeConditionalStores()
2583 BasicBlock *PFB = PBI->getSuccessor(1); in mergeConditionalStores()
2614 !HasOnePredAndOneSucc(PFB, PBI->getParent(), QBI->getParent()) || in mergeConditionalStores()
2617 if ((PTB && !HasOnePredAndOneSucc(PTB, PBI->getParent(), QBI->getParent())) || in mergeConditionalStores()
2657 static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI, in SimplifyCondBranchToCondBranch() argument
2659 assert(PBI->isConditional() && BI->isConditional()); in SimplifyCondBranchToCondBranch()
2665 if (PBI->getCondition() == BI->getCondition() && in SimplifyCondBranchToCondBranch()
2666 PBI->getSuccessor(0) != PBI->getSuccessor(1)) { in SimplifyCondBranchToCondBranch()
2671 bool CondIsTrue = PBI->getSuccessor(0) == BB; in SimplifyCondBranchToCondBranch()
2690 if ((PBI = dyn_cast<BranchInst>(P->getTerminator())) && in SimplifyCondBranchToCondBranch()
2691 PBI != BI && PBI->isConditional() && in SimplifyCondBranchToCondBranch()
2692 PBI->getCondition() == BI->getCondition() && in SimplifyCondBranchToCondBranch()
2693 PBI->getSuccessor(0) != PBI->getSuccessor(1)) { in SimplifyCondBranchToCondBranch()
2694 bool CondIsTrue = PBI->getSuccessor(0) == BB; in SimplifyCondBranchToCondBranch()
2713 if (PBI->getSuccessor(0) == BI->getParent() && in SimplifyCondBranchToCondBranch()
2714 isImpliedCondition(PBI->getCondition(), BI->getCondition(), DL) && in SimplifyCondBranchToCondBranch()
2715 PBI->getSuccessor(0) != PBI->getSuccessor(1) && in SimplifyCondBranchToCondBranch()
2727 if (MergeCondStores && mergeConditionalStores(PBI, BI)) in SimplifyCondBranchToCondBranch()
2741 if (PBI->getSuccessor(0) == BI->getSuccessor(0)) in SimplifyCondBranchToCondBranch()
2743 else if (PBI->getSuccessor(0) == BI->getSuccessor(1)) in SimplifyCondBranchToCondBranch()
2745 else if (PBI->getSuccessor(1) == BI->getSuccessor(0)) in SimplifyCondBranchToCondBranch()
2747 else if (PBI->getSuccessor(1) == BI->getSuccessor(1)) in SimplifyCondBranchToCondBranch()
2755 if (PBI->getSuccessor(PBIOp) == BB) in SimplifyCondBranchToCondBranch()
2766 BasicBlock *CommonDest = PBI->getSuccessor(PBIOp); in SimplifyCondBranchToCondBranch()
2779 unsigned PBBIdx = PN->getBasicBlockIndex(PBI->getParent()); in SimplifyCondBranchToCondBranch()
2789 DEBUG(dbgs() << "FOLDING BRs:" << *PBI->getParent() in SimplifyCondBranchToCondBranch()
2809 DEBUG(dbgs() << *PBI->getParent()->getParent()); in SimplifyCondBranchToCondBranch()
2815 Value *PBICond = PBI->getCondition(); in SimplifyCondBranchToCondBranch()
2816 IRBuilder<true, NoFolder> Builder(PBI); in SimplifyCondBranchToCondBranch()
2828 PBI->setCondition(Cond); in SimplifyCondBranchToCondBranch()
2829 PBI->setSuccessor(0, CommonDest); in SimplifyCondBranchToCondBranch()
2830 PBI->setSuccessor(1, OtherDest); in SimplifyCondBranchToCondBranch()
2834 bool PredHasWeights = ExtractBranchMetadata(PBI, PredTrueWeight, in SimplifyCondBranchToCondBranch()
2852 PBI->setMetadata(LLVMContext::MD_prof, in SimplifyCondBranchToCondBranch()
2859 AddPredecessorToBlock(OtherDest, PBI->getParent(), BB); in SimplifyCondBranchToCondBranch()
2869 unsigned PBBIdx = PN->getBasicBlockIndex(PBI->getParent()); in SimplifyCondBranchToCondBranch()
2879 DEBUG(dbgs() << "INTO: " << *PBI->getParent()); in SimplifyCondBranchToCondBranch()
2880 DEBUG(dbgs() << *PBI->getParent()->getParent()); in SimplifyCondBranchToCondBranch()
4999 if (BranchInst *PBI = dyn_cast<BranchInst>((*PI)->getTerminator())) in SimplifyCondBranch() local
5000 if (PBI != BI && PBI->isConditional()) in SimplifyCondBranch()
5001 if (SimplifyCondBranchToCondBranch(PBI, BI, DL)) in SimplifyCondBranch()
5007 if (BranchInst *PBI = dyn_cast<BranchInst>(PrevBB->getTerminator())) in SimplifyCondBranch() local
5008 if (PBI != BI && PBI->isConditional()) in SimplifyCondBranch()
5009 if (mergeConditionalStores(PBI, BI)) in SimplifyCondBranch()