Lines Matching refs:BB

231     for (const auto *BB : Scc) {  in SccInfo()  local
232 LLVM_DEBUG(dbgs() << " " << BB->getName()); in SccInfo()
233 SccNums[BB] = SccNum; in SccInfo()
234 calculateSccBlockType(BB, SccNum); in SccInfo()
240 int BranchProbabilityInfo::SccInfo::getSCCNum(const BasicBlock *BB) const { in getSCCNum()
241 auto SccIt = SccNums.find(BB); in getSCCNum()
251 const auto *BB = MapIt.first; in getSccEnterBlocks() local
252 if (isSCCHeader(BB, SccNum)) in getSccEnterBlocks()
253 for (const auto *Pred : predecessors(BB)) in getSccEnterBlocks()
255 Enters.push_back(const_cast<BasicBlock *>(BB)); in getSccEnterBlocks()
262 const auto *BB = MapIt.first; in getSccExitBlocks() local
263 if (isSCCExitingBlock(BB, SccNum)) in getSccExitBlocks()
264 for (const auto *Succ : successors(BB)) in getSccExitBlocks()
270 uint32_t BranchProbabilityInfo::SccInfo::getSccBlockType(const BasicBlock *BB, in getSccBlockType() argument
272 assert(getSCCNum(BB) == SccNum); in getSccBlockType()
277 auto It = SccBlockTypes.find(BB); in getSccBlockType()
284 void BranchProbabilityInfo::SccInfo::calculateSccBlockType(const BasicBlock *BB, in calculateSccBlockType() argument
286 assert(getSCCNum(BB) == SccNum); in calculateSccBlockType()
289 if (llvm::any_of(predecessors(BB), [&](const BasicBlock *Pred) { in calculateSccBlockType()
296 if (llvm::any_of(successors(BB), [&](const BasicBlock *Succ) { in calculateSccBlockType()
310 SccBlockTypes.insert(std::make_pair(BB, BlockType)); in calculateSccBlockType()
315 BranchProbabilityInfo::LoopBlock::LoopBlock(const BasicBlock *BB, in LoopBlock() argument
318 : BB(BB) { in LoopBlock()
319 LD.first = LI.getLoopFor(BB); in LoopBlock()
321 LD.second = SccI.getSCCNum(BB); in LoopBlock()
379 bool BranchProbabilityInfo::calcMetadataWeights(const BasicBlock *BB) { in calcMetadataWeights() argument
380 const Instruction *TI = BB->getTerminator(); in calcMetadataWeights()
404 const LoopBlock SrcLoopBB = getLoopBlock(BB); in calcMetadataWeights()
444 setEdgeProbability(BB, BP); in calcMetadataWeights()
508 setEdgeProbability(BB, BP); in calcMetadataWeights()
515 bool BranchProbabilityInfo::calcPointerHeuristics(const BasicBlock *BB) { in calcPointerHeuristics() argument
516 const BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator()); in calcPointerHeuristics()
535 setEdgeProbability(BB, Search->second); in calcPointerHeuristics()
543 computeUnlikelySuccessors(const BasicBlock *BB, Loop *L, in computeUnlikelySuccessors() argument
566 const BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator()); in computeUnlikelySuccessors()
620 if (!CmpLHSConst || !llvm::is_contained(successors(BB), B)) in computeUnlikelySuccessors()
623 const DataLayout &DL = BB->getDataLayout(); in computeUnlikelySuccessors()
646 BranchProbabilityInfo::getEstimatedBlockWeight(const BasicBlock *BB) const { in getEstimatedBlockWeight()
647 auto WeightIt = EstimatedBlockWeight.find(BB); in getEstimatedBlockWeight()
698 BasicBlock *BB = LoopBB.getBlock(); in updateEstimatedBlockWeight() local
705 if (!EstimatedBlockWeight.insert({BB, BBWeight}).second) in updateEstimatedBlockWeight()
708 for (BasicBlock *PredBlock : predecessors(BB)) { in updateEstimatedBlockWeight()
736 const BasicBlock *BB = LoopBB.getBlock(); in propagateEstimatedBlockWeight() local
737 const auto *DTStartNode = DT->getNode(BB); in propagateEstimatedBlockWeight()
738 const auto *PDTStartNode = PDT->getNode(BB); in propagateEstimatedBlockWeight()
766 BranchProbabilityInfo::getInitialEstimatedBlockWeight(const BasicBlock *BB) { in getInitialEstimatedBlockWeight() argument
768 auto hasNoReturn = [&](const BasicBlock *BB) { in getInitialEstimatedBlockWeight() argument
769 for (const auto &I : reverse(*BB)) in getInitialEstimatedBlockWeight()
780 if (isa<UnreachableInst>(BB->getTerminator()) || in getInitialEstimatedBlockWeight()
785 BB->getTerminatingDeoptimizeCall()) in getInitialEstimatedBlockWeight()
786 return hasNoReturn(BB) in getInitialEstimatedBlockWeight()
791 if (BB->isEHPad()) in getInitialEstimatedBlockWeight()
795 for (const auto &I : *BB) in getInitialEstimatedBlockWeight()
815 for (const auto *BB : RPOT) in computeEestimateBlockWeight() local
816 if (auto BBWeight = getInitialEstimatedBlockWeight(BB)) in computeEestimateBlockWeight()
819 propagateEstimatedBlockWeight(getLoopBlock(BB), DT, PDT, *BBWeight, in computeEestimateBlockWeight()
853 const BasicBlock *BB = BlockWorkList.pop_back_val(); in computeEestimateBlockWeight() local
854 if (EstimatedBlockWeight.count(BB)) in computeEestimateBlockWeight()
863 const LoopBlock LoopBB = getLoopBlock(BB); in computeEestimateBlockWeight()
864 auto MaxWeight = getMaxEstimatedEdgeWeight(LoopBB, successors(BB)); in computeEestimateBlockWeight()
876 bool BranchProbabilityInfo::calcEstimatedHeuristics(const BasicBlock *BB) { in calcEstimatedHeuristics() argument
877 assert(BB->getTerminator()->getNumSuccessors() > 1 && in calcEstimatedHeuristics()
880 const LoopBlock LoopBB = getLoopBlock(BB); in calcEstimatedHeuristics()
885 computeUnlikelySuccessors(BB, LoopBB.getLoop(), UnlikelyBlocks); in calcEstimatedHeuristics()
892 for (const BasicBlock *SuccBB : successors(BB)) { in calcEstimatedHeuristics()
933 assert(SuccWeights.size() == succ_size(BB) && "Missed successor?"); in calcEstimatedHeuristics()
959 setEdgeProbability(BB, EdgeProbabilities); in calcEstimatedHeuristics()
963 bool BranchProbabilityInfo::calcZeroHeuristics(const BasicBlock *BB, in calcZeroHeuristics() argument
965 const BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator()); in calcZeroHeuristics()
1026 setEdgeProbability(BB, Search->second); in calcZeroHeuristics()
1030 bool BranchProbabilityInfo::calcFloatingPointHeuristics(const BasicBlock *BB) { in calcFloatingPointHeuristics() argument
1031 const BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator()); in calcFloatingPointHeuristics()
1054 setEdgeProbability(BB, ProbList); in calcFloatingPointHeuristics()
1201 void BranchProbabilityInfo::eraseBlock(const BasicBlock *BB) { in eraseBlock() argument
1202 LLVM_DEBUG(dbgs() << "eraseBlock " << BB->getName() << "\n"); in eraseBlock()
1211 Handles.erase(BasicBlockCallbackVH(BB, this)); in eraseBlock()
1213 auto MapI = Probs.find(std::make_pair(BB, I)); in eraseBlock()
1215 assert(Probs.count(std::make_pair(BB, I + 1)) == 0 && in eraseBlock()
1254 for (const auto *BB : post_order(&F.getEntryBlock())) { in calculate() local
1255 LLVM_DEBUG(dbgs() << "Computing probabilities for " << BB->getName() in calculate()
1258 if (BB->getTerminator()->getNumSuccessors() < 2) in calculate()
1260 if (calcMetadataWeights(BB)) in calculate()
1262 if (calcEstimatedHeuristics(BB)) in calculate()
1264 if (calcPointerHeuristics(BB)) in calculate()
1266 if (calcZeroHeuristics(BB, TLI)) in calculate()
1268 if (calcFloatingPointHeuristics(BB)) in calculate()