Lines Matching full:bb

271   BlockChain(BlockToChainMapType &BlockToChain, MachineBasicBlock *BB)  in BlockChain()  argument
272 : Blocks(1, BB), BlockToChain(BlockToChain) { in BlockChain()
273 assert(BB && "Cannot create a chain with a null basic block"); in BlockChain()
274 BlockToChain[BB] = this; in BlockChain()
289 bool remove(MachineBasicBlock* BB) { in remove() argument
291 if (*i == BB) { in remove()
305 void merge(MachineBasicBlock *BB, BlockChain *Chain) { in merge() argument
306 assert(BB && "Can't merge a null block."); in merge()
311 assert(!BlockToChain[BB] && in merge()
312 "Passed chain is null, but BB has entry in BlockToChain."); in merge()
313 Blocks.push_back(BB); in merge()
314 BlockToChain[BB] = this; in merge()
318 assert(BB == *Chain->begin() && "Passed BB is not head of Chain."); in merge()
356 MachineBasicBlock *BB = nullptr; member
443 BlockFrequency getBlockCountOrFrequency(const MachineBasicBlock *BB) { in getBlockCountOrFrequency() argument
445 auto Count = MBFI->getBlockProfileCount(BB); in getBlockCountOrFrequency()
451 return MBFI->getBlockFreq(BB); in getBlockCountOrFrequency()
455 BlockFrequency scaleThreshold(MachineBasicBlock *BB);
467 const BlockChain &Chain, const MachineBasicBlock *BB,
473 const MachineBasicBlock *BB, const BlockChain &Chain,
476 bool isBestSuccessor(MachineBasicBlock *BB, MachineBasicBlock *Pred,
479 MachineBasicBlock *BB,
482 MachineBasicBlock *BB, MachineBasicBlock *&LPred,
488 maybeTailDuplicateBlock(MachineBasicBlock *BB, MachineBasicBlock *LPred,
494 const MachineBasicBlock *BB, const MachineBasicBlock *Succ,
499 const MachineBasicBlock *BB, const BlockChain &Chain,
520 void buildChain(const MachineBasicBlock *BB, BlockChain &Chain,
552 bool shouldTailDuplicate(MachineBasicBlock *BB);
556 const MachineBasicBlock *BB, const MachineBasicBlock *Succ,
561 bool isTrellis(const MachineBasicBlock *BB,
567 const MachineBasicBlock *BB,
574 const MachineBasicBlock *BB,
580 const MachineBasicBlock *BB, MachineBasicBlock *Succ,
642 static std::string getBlockName(const MachineBasicBlock *BB) { in INITIALIZE_PASS_DEPENDENCY()
645 OS << printMBBReference(*BB); in INITIALIZE_PASS_DEPENDENCY()
646 OS << " ('" << BB->getName() << "')"; in INITIALIZE_PASS_DEPENDENCY()
704 /// \p BB that are allowed to be its layout successors, and return
705 /// the total branch probability of edges from \p BB to those
708 const MachineBasicBlock *BB, const BlockChain &Chain, in collectViableSuccessors() argument
728 for (MachineBasicBlock *Succ : BB->successors()) { in collectViableSuccessors()
743 AdjustedSumProb -= MBPI->getEdgeProbability(BB, Succ); in collectViableSuccessors()
767 /// Check if \p BB has exactly the successors in \p Successors.
769 hasSameSuccessors(MachineBasicBlock &BB, in hasSameSuccessors() argument
771 if (BB.succ_size() != Successors.size()) in hasSameSuccessors()
774 if (Successors.count(&BB)) in hasSameSuccessors()
776 for (MachineBasicBlock *Succ : BB.successors()) in hasSameSuccessors()
784 /// \p BB Block to check.
785 bool MachineBlockPlacement::shouldTailDuplicate(MachineBasicBlock *BB) { in shouldTailDuplicate() argument
789 bool IsSimple = TailDup.isSimpleBB(BB); in shouldTailDuplicate()
791 if (BB->succ_size() == 1) in shouldTailDuplicate()
793 return TailDup.shouldTailDuplicate(IsSimple, *BB); in shouldTailDuplicate()
815 const MachineBasicBlock *BB, const MachineBasicBlock *Succ, in isProfitableToTailDup() argument
821 // BB BB in isProfitableToTailDup()
846 BranchProbability PProb = MBPI->getEdgeProbability(BB, Succ); in isProfitableToTailDup()
847 auto BBFreq = MBFI->getBlockFreq(BB); in isProfitableToTailDup()
870 // from BB. in isProfitableToTailDup()
873 if (SuccPred == Succ || SuccPred == BB in isProfitableToTailDup()
882 // Qin is Succ's best unplaced incoming edge that isn't BB in isProfitableToTailDup()
885 // BB BB in isProfitableToTailDup()
919 // BB BB BB BB in isProfitableToTailDup()
937 // BB, Succ, (C+Succ), D, Dom or the layout: in isProfitableToTailDup()
938 // BB, Succ, D, Dom, (C+Succ) in isProfitableToTailDup()
961 /// Check for a trellis layout. \p BB is the upper part of a trellis if its
964 /// have all of S as successors. We ignore trellises where BB doesn't have 2
969 const MachineBasicBlock *BB, in isTrellis() argument
972 // Technically BB could form a trellis with branching factor higher than 2. in isTrellis()
974 if (BB->succ_size() != 2 || ViableSuccs.size() != 2) in isTrellis()
977 SmallPtrSet<const MachineBasicBlock *, 2> Successors(BB->succ_begin(), in isTrellis()
978 BB->succ_end()); in isTrellis()
994 if (SuccPred == BB || (BlockFilter && !BlockFilter->count(SuccPred)) || in isTrellis()
1004 // If one of the successors has only BB as a predecessor, it is not a in isTrellis()
1020 const MachineBasicBlock *BB, in getBestNonConflictingEdges() argument
1049 // Arrange for the BB edge to be in BestA if it exists. in getBestNonConflictingEdges()
1050 if (BestB->Src == BB) in getBestNonConflictingEdges()
1055 /// Get the best successor from \p BB based on \p BB being part of a trellis.
1061 /// comes from \p BB, it will be in \p BestEdges[0]
1064 const MachineBasicBlock *BB, in getBestTrellisSuccessor() argument
1070 SmallPtrSet<const MachineBasicBlock *, 4> Successors(BB->succ_begin(), in getBestTrellisSuccessor()
1071 BB->succ_end()); in getBestTrellisSuccessor()
1084 // Skip any placed predecessors that are not BB in getBestTrellisSuccessor()
1085 if (SuccPred != BB) in getBestTrellisSuccessor()
1099 std::tie(BestA, BestB) = getBestNonConflictingEdges(BB, Edges); in getBestTrellisSuccessor()
1101 if (BestA.Src != BB) { in getBestTrellisSuccessor()
1102 // If we have a trellis, and BB doesn't have the best fallthrough edges, in getBestTrellisSuccessor()
1113 // The edges are BB->Succ1->Succ2, and we're looking to see if BB->Succ2 in getBestTrellisSuccessor()
1119 canTailDuplicateUnplacedPreds(BB, Succ2, Chain, BlockFilter) && in getBestTrellisSuccessor()
1120 isProfitableToTailDup(BB, Succ2, MBPI->getEdgeProbability(BB, Succ1), in getBestTrellisSuccessor()
1123 MBPI->getEdgeProbability(BB, Succ2), AdjustedSumProb); in getBestTrellisSuccessor()
1127 Result.BB = Succ2; in getBestTrellisSuccessor()
1138 MBPI->getEdgeProbability(BB, TrellisSucc), AdjustedSumProb); in getBestTrellisSuccessor()
1141 Result.BB = TrellisSucc; in getBestTrellisSuccessor()
1146 /// fallthrough candidate block \p Succ (of block \p BB) can be tail-duplicated
1147 /// into all of its unplaced, unfiltered predecessors, that are not BB.
1149 const MachineBasicBlock *BB, MachineBasicBlock *Succ, in canTailDuplicateUnplacedPreds() argument
1160 SmallPtrSet<const MachineBasicBlock *, 4> Successors(BB->succ_begin(), in canTailDuplicateUnplacedPreds()
1161 BB->succ_end()); in canTailDuplicateUnplacedPreds()
1166 if (Pred == BB || (BlockFilter && !BlockFilter->count(Pred)) in canTailDuplicateUnplacedPreds()
1178 // | C | C+BB in canTailDuplicateUnplacedPreds()
1181 // BB => BB | in canTailDuplicateUnplacedPreds()
1189 // After BB was duplicated into C, the layout looks like the one on the in canTailDuplicateUnplacedPreds()
1190 // right. BB and C now have the same successors. When considering in canTailDuplicateUnplacedPreds()
1220 // This is mainly for function exit BB. in canTailDuplicateUnplacedPreds()
1298 for (MachineBasicBlock &BB : *F) { in precomputeTriangleChains()
1299 // If BB doesn't have 2 successors, it doesn't start a triangle. in precomputeTriangleChains()
1300 if (BB.succ_size() != 2) in precomputeTriangleChains()
1303 for (MachineBasicBlock *Succ : BB.successors()) { in precomputeTriangleChains()
1304 if (!MPDT->dominates(Succ, &BB)) in precomputeTriangleChains()
1309 // If BB doesn't have a post-dominating successor, it doesn't form a in precomputeTriangleChains()
1314 if (MBPI->getEdgeProbability(&BB, PDom) < BranchProbability(50, 100)) in precomputeTriangleChains()
1321 // If PDom can't tail-duplicate into it's non-BB predecessors, then this in precomputeTriangleChains()
1324 if (Pred == &BB) in precomputeTriangleChains()
1339 // the find key is BB, but the insert/emplace key is PDom. in precomputeTriangleChains()
1340 auto Found = TriangleChainMap.find(&BB); in precomputeTriangleChains()
1349 auto InsertResult = TriangleChainMap.try_emplace(PDom, &BB, PDom); in precomputeTriangleChains()
1384 const MachineBasicBlock *BB) { in getLayoutSuccessorProbThreshold() argument
1385 if (!BB->getParent()->getFunction().hasProfileData()) in getLayoutSuccessorProbThreshold()
1387 if (BB->succ_size() == 2) { in getLayoutSuccessorProbThreshold()
1388 const MachineBasicBlock *Succ1 = *BB->succ_begin(); in getLayoutSuccessorProbThreshold()
1389 const MachineBasicBlock *Succ2 = *(BB->succ_begin() + 1); in getLayoutSuccessorProbThreshold()
1391 /* See case 1 below for the cost analysis. For BB->Succ to in getLayoutSuccessorProbThreshold()
1393 * Prob(BB->Succ) > 2 * Prob(BB->Pred) in getLayoutSuccessorProbThreshold()
1395 * (1-T) * Prob(BB->Succ) > T * Prob(BB->Pred) in getLayoutSuccessorProbThreshold()
1408 /// predecessor than \c BB. If yes, returns true.
1412 /// \p Chain: The chain that BB belongs to and Succ is being considered for.
1416 const MachineBasicBlock *BB, const MachineBasicBlock *Succ, in hasBetterLayoutPredecessor() argument
1428 // BB in hasBetterLayoutPredecessor()
1435 // set Succ as the layout successor of BB. Picking Succ as BB's in hasBetterLayoutPredecessor()
1437 // With this layout, Pred BB in hasBetterLayoutPredecessor()
1439 // branch taken from BB to Pred, plus the cost of back taken branch in hasBetterLayoutPredecessor()
1444 // from BB to Succ, so to make BB->Succ a viable candidate, the following in hasBetterLayoutPredecessor()
1446 // 2 * freq(BB->Pred) * taken_branch_cost + unconditional_jump_cost in hasBetterLayoutPredecessor()
1447 // < freq(BB->Succ) * taken_branch_cost. in hasBetterLayoutPredecessor()
1449 // freq(BB->Succ) > 2 * freq(BB->Pred), i.e., in hasBetterLayoutPredecessor()
1450 // prob(BB->Succ) > 2 * prob(BB->Pred) in hasBetterLayoutPredecessor()
1453 // probability threshold that is needed for edge BB->Succ to be considered. in hasBetterLayoutPredecessor()
1461 // BB Pred in hasBetterLayoutPredecessor()
1466 // The current block is BB and edge BB->Succ is now being evaluated. in hasBetterLayoutPredecessor()
1467 // Note that edge S->BB was previously already selected because in hasBetterLayoutPredecessor()
1468 // prob(S->BB) > prob(S->Pred). in hasBetterLayoutPredecessor()
1469 // At this point, 2 blocks can be placed after BB: Pred or Succ. If we in hasBetterLayoutPredecessor()
1478 // ---BB | | BB in hasBetterLayoutPredecessor()
1484 // cost = freq(S->Pred) + freq(BB->Succ) cost = 2 * freq (S->Pred) in hasBetterLayoutPredecessor()
1485 // = freq(S->Pred) + freq(S->BB) in hasBetterLayoutPredecessor()
1488 // cost (number of taken branches) with layout S->BB->Succ->Pred is 2 * in hasBetterLayoutPredecessor()
1489 // freq(S->Pred) while the cost of topo order is freq(S->Pred) + freq(S->BB). in hasBetterLayoutPredecessor()
1490 // We know Prob(S->BB) > Prob(S->Pred), so freq(S->BB) > freq(S->Pred), which in hasBetterLayoutPredecessor()
1495 // strong biased branch at block S with Prob(S->BB) in order to select in hasBetterLayoutPredecessor()
1496 // BB->Succ. This is equivalent to looking the CFG backward with backward in hasBetterLayoutPredecessor()
1497 // edge: Prob(Succ->BB) needs to >= HotProb in order to be selected (without in hasBetterLayoutPredecessor()
1504 // BB Pred in hasBetterLayoutPredecessor()
1512 // The current block is BB and edge BB->S1 is now being evaluated. in hasBetterLayoutPredecessor()
1513 // As above S->BB was already selected because in hasBetterLayoutPredecessor()
1514 // prob(S->BB) > prob(S->Pred). Assume that prob(BB->S1) >= prob(BB->S2). in hasBetterLayoutPredecessor()
1520 // ---BB | | BB in hasBetterLayoutPredecessor()
1528 // topo-cost = freq(S->Pred) + freq(BB->S1) + freq(BB->S2) in hasBetterLayoutPredecessor()
1531 // non-topo-cost = 2 * freq(S->Pred) + freq(BB->S2). in hasBetterLayoutPredecessor()
1534 // freq(S->Pred) < freq(BB->S1). in hasBetterLayoutPredecessor()
1538 BranchProbability HotProb = getLayoutSuccessorProbThreshold(BB); in hasBetterLayoutPredecessor()
1542 BlockFrequency CandidateEdgeFreq = MBFI->getBlockFreq(BB) * RealSuccProb; in hasBetterLayoutPredecessor()
1551 // called for lookahead by isProfitableToTailDup when BB hasn't been in hasBetterLayoutPredecessor()
1553 (Pred == BB)) in hasBetterLayoutPredecessor()
1558 // BB Pred in hasBetterLayoutPredecessor()
1561 // We select edge BB->Succ if in hasBetterLayoutPredecessor()
1562 // freq(BB->Succ) > freq(Succ) * HotProb in hasBetterLayoutPredecessor()
1563 // i.e. freq(BB->Succ) > freq(BB->Succ) * HotProb + freq(Pred->Succ) * in hasBetterLayoutPredecessor()
1565 // i.e. freq((BB->Succ) * (1 - HotProb) > freq(Pred->Succ) * HotProb in hasBetterLayoutPredecessor()
1567 // prob(BB->Succ) > HotProb. (freq(Succ) = freq(BB) for a triangle) in hasBetterLayoutPredecessor()
1597 const MachineBasicBlock *BB, const BlockChain &Chain, in selectBestSuccessor() argument
1606 collectViableSuccessors(BB, Chain, BlockFilter, Successors); in selectBestSuccessor()
1608 LLVM_DEBUG(dbgs() << "Selecting best successor for: " << getBlockName(BB) in selectBestSuccessor()
1611 // if we already precomputed the best successor for BB, return that if still in selectBestSuccessor()
1613 auto FoundEdge = ComputedEdges.find(BB); in selectBestSuccessor()
1615 MachineBasicBlock *Succ = FoundEdge->second.BB; in selectBestSuccessor()
1618 if (BB->isSuccessor(Succ) && (!BlockFilter || BlockFilter->count(Succ)) && in selectBestSuccessor()
1623 // if BB is part of a trellis, Use the trellis to determine the optimal in selectBestSuccessor()
1625 if (isTrellis(BB, Successors, Chain, BlockFilter)) in selectBestSuccessor()
1626 return getBestTrellisSuccessor(BB, Successors, AdjustedSumProb, Chain, in selectBestSuccessor()
1635 auto RealSuccProb = MBPI->getEdgeProbability(BB, Succ); in selectBestSuccessor()
1640 // Skip the edge \c BB->Succ if block \c Succ has a better layout in selectBestSuccessor()
1642 if (hasBetterLayoutPredecessor(BB, Succ, SuccChain, SuccProb, RealSuccProb, in selectBestSuccessor()
1656 if (BestSucc.BB && BestProb >= SuccProb) { in selectBestSuccessor()
1662 BestSucc.BB = Succ; in selectBestSuccessor()
1681 if (canTailDuplicateUnplacedPreds(BB, Succ, Chain, BlockFilter) in selectBestSuccessor()
1682 && (isProfitableToTailDup(BB, Succ, BestProb, Chain, BlockFilter))) { in selectBestSuccessor()
1686 BestSucc.BB = Succ; in selectBestSuccessor()
1692 if (BestSucc.BB) in selectBestSuccessor()
1693 LLVM_DEBUG(dbgs() << " Selected: " << getBlockName(BestSucc.BB) << "\n"); in selectBestSuccessor()
1714 llvm::erase_if(WorkList, [&](MachineBasicBlock *BB) { in selectBestCandidateBlock() argument
1715 return BlockToChain.lookup(BB) == &Chain; in selectBestCandidateBlock()
1844 MachineBasicBlock *BB = *Chain.begin(); in fillWorkLists() local
1845 if (BB->isEHPad()) in fillWorkLists()
1846 EHPadWorkList.push_back(BB); in fillWorkLists()
1848 BlockWorkList.push_back(BB); in fillWorkLists()
1854 assert(HeadBB && "BB must not be null.\n"); in buildChain()
1863 MachineBasicBlock *BB = *std::prev(Chain.end()); in buildChain() local
1865 assert(BB && "null block found at end of chain in loop."); in buildChain()
1866 assert(BlockToChain[BB] == &Chain && "BlockToChainMap mis-match in loop."); in buildChain()
1867 assert(*std::prev(Chain.end()) == BB && "BB Not found at end of chain."); in buildChain()
1872 auto Result = selectBestSuccessor(BB, Chain, BlockFilter); in buildChain()
1873 MachineBasicBlock* BestSucc = Result.BB; in buildChain()
1876 ShouldTailDup |= (BestSucc && canTailDuplicateUnplacedPreds(BB, BestSucc, in buildChain()
1904 repeatedlyTailDuplicateBlock(BestSucc, BB, LoopHeaderBB, Chain, in buildChain()
1907 // If the chosen successor was duplicated into BB, don't bother laying in buildChain()
1908 // it out, just go round the loop again with BB as the chain end. in buildChain()
1909 if (!BB->isSuccessor(BestSucc)) in buildChain()
1918 LLVM_DEBUG(dbgs() << "Merging from " << getBlockName(BB) << " to " in buildChain()
1922 BB = *std::prev(Chain.end()); in buildChain()
1929 // If bottom of block BB has only one successor OldTop, in most cases it is
1938 // BB-----
1940 // If BB is moved before OldTop, Pred needs a taken branch to BB, and it can't
2179 /// BB can be found.
2382 // The entry block should always be the first BB in a function. in rotateLoop()
2431 "Exit should not be last BB"); in rotateLoop()
2448 /// 1. The possibly missed fall through edge (if it exists) from BB out of
2451 /// exits to BB out of the loop.
2452 /// 3. The missed fall through edge (if it exists) from the last BB to the
2453 /// first BB in the loop chain.
2462 // The entry block should always be the first BB in a function. in rotateLoopWithProfile()
2503 for (auto *BB : LoopChain) { in rotateLoopWithProfile() local
2505 for (auto *Succ : BB->successors()) { in rotateLoopWithProfile()
2509 auto SuccProb = MBPI->getEdgeProbability(BB, Succ); in rotateLoopWithProfile()
2514 auto ExitFreq = MBFI->getBlockFreq(BB) * LargestExitEdgeProb; in rotateLoopWithProfile()
2515 ExitsWithFreq.emplace_back(BB, ExitFreq); in rotateLoopWithProfile()
2532 // Calculate the cost by putting this BB to the top. in rotateLoopWithProfile()
2535 // If the current BB is the loop header, we need to take into account the in rotateLoopWithProfile()
2733 // Ensure that every BB in the function has an associated chain to simplify in buildCFGChains()
2738 MachineBasicBlock *BB = &*FI; in buildCFGChains() local
2740 new (ChainAllocator.Allocate()) BlockChain(BlockToChain, BB); in buildCFGChains()
2746 if (!TII->analyzeBranch(*BB, TBB, FBB, Cond) || !FI->canFallThrough()) in buildCFGChains()
2755 << getBlockName(BB) << " -> " << getBlockName(NextBB) in buildCFGChains()
2759 BlocksWithUnanalyzableExits.insert(&*BB); in buildCFGChains()
2762 BB = NextBB; in buildCFGChains()
3039 /// Tail duplicate \p BB into (some) predecessors if profitable, repeating if
3041 /// \p BB - Basic block that may be duplicated.
3043 /// \p LPred - Chosen layout predecessor of \p BB.
3045 /// \p Chain - Chain to which \p LPred belongs, and \p BB will belong.
3051 /// only needed if \p BB is removed and
3052 /// \p PrevUnplacedBlockIt pointed to \p BB.
3053 /// @return true if \p BB was removed.
3055 MachineBasicBlock *BB, MachineBasicBlock *&LPred, in repeatedlyTailDuplicateBlock() argument
3062 BB, LPred, Chain, BlockFilter, PrevUnplacedBlockIt, in repeatedlyTailDuplicateBlock()
3088 // If BB was duplicated into LPred, it is now scheduled. But because it was in repeatedlyTailDuplicateBlock()
3099 /// Tail duplicate \p BB into (some) predecessors if profitable.
3100 /// \p BB - Basic block that may be duplicated
3101 /// \p LPred - Chosen layout predecessor of \p BB
3102 /// \p Chain - Chain to which \p LPred belongs, and \p BB will belong.
3108 /// only needed if \p BB is removed and
3109 /// \p PrevUnplacedBlockIt pointed to \p BB.
3113 MachineBasicBlock *BB, MachineBasicBlock *LPred, BlockChain &Chain, in maybeTailDuplicateBlock() argument
3118 if (!shouldTailDuplicate(BB)) in maybeTailDuplicateBlock()
3121 LLVM_DEBUG(dbgs() << "Redoing tail duplication for Succ#" << BB->getNumber() in maybeTailDuplicateBlock()
3125 // BB is deleted. in maybeTailDuplicateBlock()
3190 bool IsSimple = TailDup.isSimpleBB(BB); in maybeTailDuplicateBlock()
3195 findDuplicateCandidates(CandidatePreds, BB, BlockFilter); in maybeTailDuplicateBlock()
3198 if (CandidatePreds.size() < BB->pred_size()) in maybeTailDuplicateBlock()
3201 TailDup.tailDuplicateAndUpdate(IsSimple, BB, LPred, &DuplicatedPreds, in maybeTailDuplicateBlock()
3238 BlockFrequency MachineBlockPlacement::scaleThreshold(MachineBasicBlock *BB) { in scaleThreshold() argument
3239 return BlockFrequency(DupThreshold.getFrequency() * countMBBInstruction(BB)); in scaleThreshold()
3242 // Returns true if BB is Pred's best successor.
3243 bool MachineBlockPlacement::isBestSuccessor(MachineBasicBlock *BB, in isBestSuccessor() argument
3246 if (BB == Pred) in isBestSuccessor()
3254 // Find the successor with largest probability excluding BB. in isBestSuccessor()
3257 if (Succ != BB) { in isBestSuccessor()
3268 BranchProbability BBProb = MBPI->getEdgeProbability(Pred, BB); in isBestSuccessor()
3272 // Compute the number of reduced taken branches if Pred falls through to BB in isBestSuccessor()
3276 return Gain > scaleThreshold(BB); in isBestSuccessor()
3279 // Find out the predecessors of BB and BB can be beneficially duplicated into
3283 MachineBasicBlock *BB, in findDuplicateCandidates() argument
3287 BlockFrequency BBDupThreshold(scaleThreshold(BB)); in findDuplicateCandidates()
3288 SmallVector<MachineBasicBlock *, 8> Preds(BB->predecessors()); in findDuplicateCandidates()
3289 SmallVector<MachineBasicBlock *, 8> Succs(BB->successors()); in findDuplicateCandidates()
3293 return MBPI->getEdgeProbability(BB, A) > MBPI->getEdgeProbability(BB, B); in findDuplicateCandidates()
3303 DefaultBranchProb = MBPI->getEdgeProbability(BB, *SuccIt).getCompl(); in findDuplicateCandidates()
3306 // For each predecessors of BB, compute the benefit of duplicating BB, in findDuplicateCandidates()
3315 // BB----/ OB in findDuplicateCandidates()
3322 // PB2+BB in findDuplicateCandidates()
3327 // | BB----/ OB in findDuplicateCandidates()
3337 // jumps to BB and the most possible successor is laid out after BB. in findDuplicateCandidates()
3339 // The Duplicated_taken_branch is computed with the assumption that BB is in findDuplicateCandidates()
3342 // block jumps to all BB's successor, like PB3 in this example. in findDuplicateCandidates()
3344 // If a predecessor has multiple successors, so BB can't be duplicated into in findDuplicateCandidates()
3345 // it. But it can beneficially fall through to BB, and duplicate BB into other in findDuplicateCandidates()
3350 if (!TailDup.canTailDuplicate(BB, Pred)) { in findDuplicateCandidates()
3351 // BB can't be duplicated into Pred, but it is possible to be layout in findDuplicateCandidates()
3353 if (!Fallthrough && isBestSuccessor(BB, Pred, BlockFilter)) { in findDuplicateCandidates()
3370 DupCost -= PredFreq * MBPI->getEdgeProbability(BB, *SuccIt); in findDuplicateCandidates()
3382 // No predecessors can optimally fallthrough to BB. in findDuplicateCandidates()