Lines Matching full:bb
97 ICNotClassfied, // BB data valid, but not classified.
99 ICSimple, // BB is entry of an one split, no rejoin sub-CFG.
103 ICTriangle, // BB is entry of a triangle sub-CFG.
104 ICDiamond, // BB is entry of a diamond sub-CFG.
105 ICForkedDiamond // BB is entry of an almost diamond sub-CFG, with a
116 /// IsDone - True if BB is not to be considered for ifcvt.
117 /// IsBeingAnalyzed - True if BB is currently being analyzed.
118 /// IsAnalyzed - True if BB has been analyzed (info is still valid).
119 /// IsEnqueued - True if BB has been enqueued to be ifcvt'ed.
121 /// HasFallThrough - True if BB may fallthrough to the following BB.
122 /// IsUnpredicable - True if BB is known to be unpredicable.
123 /// ClobbersPred - True if BB could modify predicates (e.g. has
128 /// BB - Corresponding MachineBasicBlock.
131 /// Predicate - Predicate used in the BB.
146 MachineBasicBlock *BB = nullptr; member
162 /// NeedSubsumption - True if the to-be-predicated BB has already been
282 bool MeetIfcvtSizeLimit(MachineBasicBlock &BB, in MeetIfcvtSizeLimit() argument
285 return Cycle > 0 && TII->isProfitableToIfCvt(BB, Cycle, Extra, in MeetIfcvtSizeLimit()
292 const MachineFunction &MF = *TBBInfo.BB->getParent(); in MeetIfcvtSizeLimit()
294 MachineBasicBlock::iterator TIB = TBBInfo.BB->begin(); in MeetIfcvtSizeLimit()
295 MachineBasicBlock::iterator FIB = FBBInfo.BB->begin(); in MeetIfcvtSizeLimit()
296 MachineBasicBlock::iterator TIE = TBBInfo.BB->end(); in MeetIfcvtSizeLimit()
297 MachineBasicBlock::iterator FIE = FBBInfo.BB->end(); in MeetIfcvtSizeLimit()
301 *TBBInfo.BB, *FBBInfo.BB, in MeetIfcvtSizeLimit()
309 for (auto &I : make_range(TBBInfo.BB->begin(), TIB)) { in MeetIfcvtSizeLimit()
313 for (auto &I : make_range(FBBInfo.BB->begin(), FIB)) { in MeetIfcvtSizeLimit()
322 for (auto &I : make_range(TIE, TBBInfo.BB->end())) { in MeetIfcvtSizeLimit()
331 for (auto &I : make_range(FIE, FBBInfo.BB->end())) { in MeetIfcvtSizeLimit()
388 *TBBInfo.BB, TCycle, TBBInfo.ExtraCost2, *FBBInfo.BB, in MeetIfcvtSizeLimit()
421 return C1->BBI.BB->getNumber() < C2->BBI.BB->getNumber(); in IfcvtTokenCmp()
513 << "): " << printMBBReference(*BBI.BB) << " (" in INITIALIZE_PASS_DEPENDENCY()
539 LLVM_DEBUG(dbgs() << "): " << printMBBReference(*BBI.BB) in INITIALIZE_PASS_DEPENDENCY()
556 LLVM_DEBUG(dbgs() << "Ifcvt (Diamond): " << printMBBReference(*BBI.BB) in INITIALIZE_PASS_DEPENDENCY()
568 << printMBBReference(*BBI.BB) in INITIALIZE_PASS_DEPENDENCY()
580 recomputeLivenessFlags(*BBI.BB); in INITIALIZE_PASS_DEPENDENCY()
607 /// BB has a fallthrough. Find its 'false' successor given its 'true' successor.
608 static MachineBasicBlock *findFalseBlock(MachineBasicBlock *BB, in findFalseBlock() argument
610 for (MachineBasicBlock *SuccBB : BB->successors()) { in findFalseBlock()
622 TII->removeBranch(*BBI.BB); in reverseBranchCondition()
623 TII->insertBranch(*BBI.BB, BBI.FalseBB, BBI.TrueBB, BBI.BrCond, dl); in reverseBranchCondition()
652 if (TrueBBI.BB->pred_size() > 1) { in ValidSimple()
654 !TII->isProfitableToDupForIfCvt(*TrueBBI.BB, TrueBBI.NonPredSize, in ValidSimple()
672 if (TrueBBI.BB == FalseBBI.BB) in ValidTriangle()
678 if (TrueBBI.BB->pred_size() > 1) { in ValidTriangle()
695 if (!TII->isProfitableToDupForIfCvt(*TrueBBI.BB, Size, Prediction)) in ValidTriangle()
702 MachineFunction::iterator I = TrueBBI.BB->getIterator(); in ValidTriangle()
703 if (++I == TrueBBI.BB->getParent()->end()) in ValidTriangle()
707 return TExit && TExit == FalseBBI.BB; in ValidTriangle()
886 if (TrueBBI.BB->pred_size() > 1 || FalseBBI.BB->pred_size() > 1) in ValidForkedDiamond()
901 TT = getNextBlock(*TrueBBI.BB); in ValidForkedDiamond()
903 TF = getNextBlock(*TrueBBI.BB); in ValidForkedDiamond()
905 FT = getNextBlock(*FalseBBI.BB); in ValidForkedDiamond()
907 FF = getNextBlock(*FalseBBI.BB); in ValidForkedDiamond()
930 MachineBasicBlock::iterator TIB = TrueBBI.BB->begin(); in ValidForkedDiamond()
931 MachineBasicBlock::iterator FIB = FalseBBI.BB->begin(); in ValidForkedDiamond()
932 MachineBasicBlock::iterator TIE = TrueBBI.BB->end(); in ValidForkedDiamond()
933 MachineBasicBlock::iterator FIE = FalseBBI.BB->end(); in ValidForkedDiamond()
935 *TrueBBI.BB, *FalseBBI.BB, in ValidForkedDiamond()
939 TrueBBICalc.BB = TrueBBI.BB; in ValidForkedDiamond()
940 FalseBBICalc.BB = FalseBBI.BB; in ValidForkedDiamond()
967 if (TrueBBI.BB == FalseBBI.BB) in ValidDiamond()
974 TT = getNextBlock(*TrueBBI.BB); in ValidDiamond()
976 FT = getNextBlock(*FalseBBI.BB); in ValidDiamond()
981 if (TrueBBI.BB->pred_size() > 1 || FalseBBI.BB->pred_size() > 1) in ValidDiamond()
994 MachineBasicBlock::iterator TIB = TrueBBI.BB->begin(); in ValidDiamond()
995 MachineBasicBlock::iterator FIB = FalseBBI.BB->begin(); in ValidDiamond()
996 MachineBasicBlock::iterator TIE = TrueBBI.BB->end(); in ValidDiamond()
997 MachineBasicBlock::iterator FIE = FalseBBI.BB->end(); in ValidDiamond()
999 *TrueBBI.BB, *FalseBBI.BB, in ValidDiamond()
1003 TrueBBICalc.BB = TrueBBI.BB; in ValidDiamond()
1004 FalseBBICalc.BB = FalseBBI.BB; in ValidDiamond()
1026 !TII->analyzeBranch(*BBI.BB, BBI.TrueBB, BBI.FalseBB, BBI.BrCond); in AnalyzeBranches()
1039 // No false branch. This BB must end with a conditional branch and a in AnalyzeBranches()
1042 BBI.FalseBB = findFalseBlock(BBI.BB, BBI.TrueBB); in AnalyzeBranches()
1221 MachineBasicBlock *BB = State.MBB; in AnalyzeBlock() local
1222 BBInfo &BBI = BBAnalysis[BB->getNumber()]; in AnalyzeBlock()
1230 BBI.BB = BB; in AnalyzeBlock()
1234 MachineBasicBlock::iterator Begin = BBI.BB->begin(); in AnalyzeBlock()
1235 MachineBasicBlock::iterator End = BBI.BB->end(); in AnalyzeBlock()
1248 if (BBI.TrueBB == BB || BBI.FalseBB == BB) { in AnalyzeBlock()
1290 BranchProbability Prediction = MBPI->getEdgeProbability(BB, TrueBBI.BB); in AnalyzeBlock()
1295 bool MeetsSize = MeetIfcvtSizeLimit(TrueBBICalc, FalseBBICalc, *BB, in AnalyzeBlock()
1344 MeetIfcvtSizeLimit(*TrueBBI.BB, TrueBBI.NonPredSize + TrueBBI.ExtraCost, in AnalyzeBlock()
1360 MeetIfcvtSizeLimit(*TrueBBI.BB, TrueBBI.NonPredSize + TrueBBI.ExtraCost, in AnalyzeBlock()
1369 MeetIfcvtSizeLimit(*TrueBBI.BB, TrueBBI.NonPredSize + TrueBBI.ExtraCost, in AnalyzeBlock()
1388 MeetIfcvtSizeLimit(*FalseBBI.BB, in AnalyzeBlock()
1399 MeetIfcvtSizeLimit(*FalseBBI.BB, in AnalyzeBlock()
1409 MeetIfcvtSizeLimit(*FalseBBI.BB, in AnalyzeBlock()
1454 /// Invalidate predecessor BB info so it would be re-analyzed to determine if it
1459 if (PBBI.IsDone || PBBI.BB == &MBB) in InvalidatePreds()
1529 MachineBasicBlock &CvtMBB = *CvtBBI->BB; in IfConvertSimple()
1530 MachineBasicBlock &NextMBB = *NextBBI->BB; in IfConvertSimple()
1540 // Conservatively abort if-conversion if BB's address is taken. in IfConvertSimple()
1550 // Initialize liveins to the first BB. These are potentially redefined by in IfConvertSimple()
1558 BBI.NonPredSize -= TII->removeBranch(*BBI.BB); in IfConvertSimple()
1566 BBI.BB->removeSuccessor(&CvtMBB, true); in IfConvertSimple()
1571 // Merge converted block into entry block. The BB to Cvt edge is removed in IfConvertSimple()
1577 if (!canFallThroughTo(*BBI.BB, NextMBB)) { in IfConvertSimple()
1578 InsertUncondBranch(*BBI.BB, NextMBB, TII); in IfConvertSimple()
1581 // BB: in IfConvertSimple()
1593 // Update block info. BB can be iteratively if-converted. in IfConvertSimple()
1596 InvalidatePreds(*BBI.BB); in IfConvertSimple()
1615 MachineBasicBlock &CvtMBB = *CvtBBI->BB; in IfConvertTriangle()
1616 MachineBasicBlock &NextMBB = *NextBBI->BB; in IfConvertTriangle()
1626 // Conservatively abort if-conversion if BB's address is taken. in IfConvertTriangle()
1635 // BB has been changed, modify its predecessors (except for this in IfConvertTriangle()
1638 if (PBB == BBI.BB) in IfConvertTriangle()
1649 // Initialize liveins to the first BB. These are potentially redefined by in IfConvertTriangle()
1661 // Get probabilities before modifying CvtMBB and BBI.BB. in IfConvertTriangle()
1664 BBNext = MBPI->getEdgeProbability(BBI.BB, &NextMBB); in IfConvertTriangle()
1665 BBCvt = MBPI->getEdgeProbability(BBI.BB, &CvtMBB); in IfConvertTriangle()
1670 BBI.NonPredSize -= TII->removeBranch(*BBI.BB); in IfConvertTriangle()
1686 BBI.BB->removeSuccessor(&CvtMBB, true); in IfConvertTriangle()
1696 // NewNext = New_Prob(BBI.BB, NextMBB) = in IfConvertTriangle()
1697 // Prob(BBI.BB, NextMBB) + in IfConvertTriangle()
1698 // Prob(BBI.BB, CvtMBB) * Prob(CvtMBB, NextMBB) in IfConvertTriangle()
1699 // NewFalse = New_Prob(BBI.BB, CvtBBI->FalseBB) = in IfConvertTriangle()
1700 // Prob(BBI.BB, CvtMBB) * Prob(CvtMBB, CvtBBI->FalseBB) in IfConvertTriangle()
1701 auto NewTrueBB = getNextBlock(*BBI.BB); in IfConvertTriangle()
1703 auto NewTrueBBIter = find(BBI.BB->successors(), NewTrueBB); in IfConvertTriangle()
1704 if (NewTrueBBIter != BBI.BB->succ_end()) in IfConvertTriangle()
1705 BBI.BB->setSuccProbability(NewTrueBBIter, NewNext); in IfConvertTriangle()
1708 TII->insertBranch(*BBI.BB, CvtBBI->FalseBB, nullptr, RevCond, dl); in IfConvertTriangle()
1709 BBI.BB->addSuccessor(CvtBBI->FalseBB, NewFalse); in IfConvertTriangle()
1716 bool isFallThrough = canFallThroughTo(*BBI.BB, NextMBB); in IfConvertTriangle()
1727 InsertUncondBranch(*BBI.BB, NextMBB, TII); in IfConvertTriangle()
1735 // Update block info. BB can be iteratively if-converted. in IfConvertTriangle()
1738 InvalidatePreds(*BBI.BB); in IfConvertTriangle()
1765 TrueBBI.BB->pred_size() > 1 || FalseBBI.BB->pred_size() > 1) { in IfConvertDiamondCommon()
1773 if (TrueBBI.BB->hasAddressTaken() || FalseBBI.BB->hasAddressTaken()) in IfConvertDiamondCommon()
1774 // Conservatively abort if-conversion if either BB has its address taken. in IfConvertDiamondCommon()
1803 BBI.NonPredSize -= TII->removeBranch(*BBI.BB); in IfConvertDiamondCommon()
1805 MachineBasicBlock &MBB1 = *BBI1->BB; in IfConvertDiamondCommon()
1806 MachineBasicBlock &MBB2 = *BBI2->BB; in IfConvertDiamondCommon()
1856 BBI.BB->splice(BBI.BB->end(), &MBB1, MBB1.begin(), DI1); in IfConvertDiamondCommon()
1897 DI2 = BBI2->BB->end(); in IfConvertDiamondCommon()
1901 BBI2->NonPredSize -= TII->removeBranch(*BBI2->BB); in IfConvertDiamondCommon()
2001 MachineBasicBlock::iterator TIE = TrueBBI.BB->getFirstTerminator(); in IfConvertForkedDiamond()
2002 if (TIE != TrueBBI.BB->end()) in IfConvertForkedDiamond()
2016 TII->insertBranch(*BBI.BB, TrueBBI.TrueBB, TrueBBI.FalseBB, in IfConvertForkedDiamond()
2021 InvalidatePreds(*BBI.BB); in IfConvertForkedDiamond()
2057 BBI.BB->removeSuccessor(TrueBBI.BB); in IfConvertDiamond()
2058 BBI.BB->removeSuccessor(FalseBBI.BB, true); in IfConvertDiamond()
2062 !TailBBI.BB->hasAddressTaken(); in IfConvertDiamond()
2066 MachineBasicBlock::const_iterator TI = BBI.BB->getFirstTerminator(); in IfConvertDiamond()
2067 if (TI != BBI.BB->end() && TII->isPredicated(*TI)) in IfConvertDiamond()
2076 if (*PI != TrueBBI.BB && *PI != FalseBBI.BB) in IfConvertDiamond()
2083 BBI.BB->addSuccessor(TailBB, BranchProbability::getOne()); in IfConvertDiamond()
2084 InsertUncondBranch(*BBI.BB, *TailBB, TII); in IfConvertDiamond()
2091 InvalidatePreds(*BBI.BB); in IfConvertDiamond()
2124 for (MachineInstr &I : make_range(BBI.BB->begin(), E)) { in PredicateBlock()
2159 /// Copy and predicate instructions from source BB to the destination block.
2164 MachineFunction &MF = *ToBBI.BB->getParent(); in CopyAndPredicateBlock()
2166 MachineBasicBlock &FromMBB = *FromBBI.BB; in CopyAndPredicateBlock()
2177 ToBBI.BB->insert(ToBBI.BB->end(), MI); in CopyAndPredicateBlock()
2209 ToBBI.BB->addSuccessor(Succ); in CopyAndPredicateBlock()
2228 MachineBasicBlock &FromMBB = *FromBBI.BB; in MergeBlocks()
2230 "Removing a BB whose address is taken!"); in MergeBlocks()
2238 if (MO.isMBB() && !ToBBI.BB->isSuccessor(MO.getMBB())) in MergeBlocks()
2239 ToBBI.BB->addSuccessor(MO.getMBB(), BranchProbability::getZero()); in MergeBlocks()
2244 MachineBasicBlock::iterator ToTI = ToBBI.BB->getFirstTerminator(); in MergeBlocks()
2245 ToBBI.BB->splice(ToTI, &FromMBB, FromMBB.begin(), FromTI); in MergeBlocks()
2249 ToTI = ToBBI.BB->end(); in MergeBlocks()
2250 ToBBI.BB->splice(ToTI, &FromMBB, FromTI, FromMBB.end()); in MergeBlocks()
2252 // Force normalizing the successors' probabilities of ToBBI.BB to convert all in MergeBlocks()
2257 ToBBI.BB->normalizeSuccProbs(); in MergeBlocks()
2262 // The edge probability from ToBBI.BB to FromMBB, which is only needed when in MergeBlocks()
2263 // AddEdges is true and FromMBB is a successor of ToBBI.BB. in MergeBlocks()
2265 if (AddEdges && ToBBI.BB->isSuccessor(&FromMBB)) { in MergeBlocks()
2268 To2FromProb = MBPI->getEdgeProbability(ToBBI.BB, &FromMBB); in MergeBlocks()
2269 ToBBI.BB->removeSuccessor(&FromMBB); in MergeBlocks()
2281 // Calculate the edge probability for the edge from ToBBI.BB to Succ, in MergeBlocks()
2283 // portion ratio is the edge probability from ToBBI.BB to FromMBB (if in MergeBlocks()
2284 // FromBBI is a successor of ToBBI.BB. See comment below for exception). in MergeBlocks()
2287 // To2FromProb is 0 when FromMBB is not a successor of ToBBI.BB. This in MergeBlocks()
2289 // tail BB. In this case FromMBB post-dominates ToBBI.BB and hence we in MergeBlocks()
2299 // If the edge from ToBBI.BB to Succ already exists, update the in MergeBlocks()
2301 // below, in which A is ToBBI.BB and B is FromMBB. In this case we in MergeBlocks()
2321 if (ToBBI.BB->isSuccessor(Succ)) in MergeBlocks()
2322 ToBBI.BB->setSuccProbability( in MergeBlocks()
2323 find(ToBBI.BB->successors(), Succ), in MergeBlocks()
2324 MBPI->getEdgeProbability(ToBBI.BB, Succ) + NewProb); in MergeBlocks()
2326 ToBBI.BB->addSuccessor(Succ, NewProb); in MergeBlocks()
2336 // Normalize the probabilities of ToBBI.BB's successors with all adjustment in MergeBlocks()
2339 ToBBI.BB->normalizeSuccProbs(); in MergeBlocks()