Lines Matching refs:MachineBasicBlock

215 using BlockToChainMapType = DenseMap<const MachineBasicBlock *, BlockChain *>;
233 SmallVector<MachineBasicBlock *, 4> Blocks;
249 BlockChain(BlockToChainMapType &BlockToChain, MachineBasicBlock *BB) in BlockChain()
256 using iterator = SmallVectorImpl<MachineBasicBlock *>::iterator;
257 using const_iterator = SmallVectorImpl<MachineBasicBlock *>::const_iterator;
267 bool remove(MachineBasicBlock* BB) { in remove()
283 void merge(MachineBasicBlock *BB, BlockChain *Chain) { in merge()
301 for (MachineBasicBlock *ChainBB : *Chain) { in merge()
311 for (MachineBasicBlock *MBB : *this) in dump()
330 using BlockFilterSet = SmallSetVector<const MachineBasicBlock *, 16>;
334 MachineBasicBlock *BB;
341 MachineBasicBlock *Src;
342 MachineBasicBlock *Dest;
346 SmallVector<MachineBasicBlock *, 16> BlockWorkList;
347 SmallVector<MachineBasicBlock *, 16> EHPadWorkList;
350 DenseMap<const MachineBasicBlock *, BlockAndTailDupResult> ComputedEdges;
367 MachineBasicBlock *PreferredLoopExit;
409 DenseMap<const MachineBasicBlock *, BlockChain *> BlockToChain;
416 SmallPtrSet<MachineBasicBlock *, 4> BlocksWithUnanalyzableExits;
421 BlockFrequency getBlockCountOrFrequency(const MachineBasicBlock *BB) { in getBlockCountOrFrequency()
433 BlockFrequency scaleThreshold(MachineBasicBlock *BB);
439 const BlockChain &Chain, const MachineBasicBlock *LoopHeaderBB,
445 const BlockChain &Chain, const MachineBasicBlock *BB,
446 const MachineBasicBlock *LoopHeaderBB,
451 const MachineBasicBlock *BB, const BlockChain &Chain,
453 SmallVector<MachineBasicBlock *, 4> &Successors);
454 bool isBestSuccessor(MachineBasicBlock *BB, MachineBasicBlock *Pred,
456 void findDuplicateCandidates(SmallVectorImpl<MachineBasicBlock *> &Candidates,
457 MachineBasicBlock *BB,
460 MachineBasicBlock *BB, MachineBasicBlock *&LPred,
461 const MachineBasicBlock *LoopHeaderBB,
465 MachineBasicBlock *BB, MachineBasicBlock *LPred,
470 const MachineBasicBlock *BB, const MachineBasicBlock *Succ,
475 const MachineBasicBlock *BB, const BlockChain &Chain,
477 MachineBasicBlock *selectBestCandidateBlock(
478 const BlockChain &Chain, SmallVectorImpl<MachineBasicBlock *> &WorkList);
479 MachineBasicBlock *getFirstUnplacedBlock(
489 void fillWorkLists(const MachineBasicBlock *MBB,
493 void buildChain(const MachineBasicBlock *BB, BlockChain &Chain,
495 bool canMoveBottomBlockToTop(const MachineBasicBlock *BottomBlock,
496 const MachineBasicBlock *OldTop);
497 bool hasViableTopFallthrough(const MachineBasicBlock *Top,
499 BlockFrequency TopFallThroughFreq(const MachineBasicBlock *Top,
501 BlockFrequency FallThroughGains(const MachineBasicBlock *NewTop,
502 const MachineBasicBlock *OldTop,
503 const MachineBasicBlock *ExitBB,
505 MachineBasicBlock *findBestLoopTopHelper(MachineBasicBlock *OldTop,
507 MachineBasicBlock *findBestLoopTop(
509 MachineBasicBlock *findBestLoopExit(
515 BlockChain &LoopChain, const MachineBasicBlock *ExitingBB,
525 bool shouldTailDuplicate(MachineBasicBlock *BB);
529 const MachineBasicBlock *BB, const MachineBasicBlock *Succ,
534 bool isTrellis(const MachineBasicBlock *BB,
535 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs,
540 const MachineBasicBlock *BB,
541 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs,
547 const MachineBasicBlock *BB,
553 const MachineBasicBlock *BB, MachineBasicBlock *Succ,
606 static std::string getBlockName(const MachineBasicBlock *BB) { in INITIALIZE_PASS_DEPENDENCY()
623 const BlockChain &Chain, const MachineBasicBlock *LoopHeaderBB, in markChainSuccessors()
627 for (MachineBasicBlock *MBB : Chain) { in markChainSuccessors()
639 const BlockChain &Chain, const MachineBasicBlock *MBB, in markBlockSuccessors()
640 const MachineBasicBlock *LoopHeaderBB, const BlockFilterSet *BlockFilter) { in markBlockSuccessors()
645 for (MachineBasicBlock *Succ : MBB->successors()) { in markBlockSuccessors()
672 const MachineBasicBlock *BB, const BlockChain &Chain, in collectViableSuccessors()
674 SmallVector<MachineBasicBlock *, 4> &Successors) { in collectViableSuccessors() argument
692 for (MachineBasicBlock *Succ : BB->successors()) { in collectViableSuccessors()
733 hasSameSuccessors(MachineBasicBlock &BB, in hasSameSuccessors()
734 SmallPtrSetImpl<const MachineBasicBlock *> &Successors) { in hasSameSuccessors()
740 for (MachineBasicBlock *Succ : BB.successors()) in hasSameSuccessors()
749 bool MachineBlockPlacement::shouldTailDuplicate(MachineBasicBlock *BB) { in shouldTailDuplicate()
779 const MachineBasicBlock *BB, const MachineBasicBlock *Succ, in isProfitableToTailDup()
805 MachineBasicBlock *PDom = nullptr; in isProfitableToTailDup()
806 SmallVector<MachineBasicBlock *, 4> SuccSuccs; in isProfitableToTailDup()
823 for (MachineBasicBlock *SuccSucc : SuccSuccs) { in isProfitableToTailDup()
836 for (MachineBasicBlock *SuccPred : Succ->predecessors()) { in isProfitableToTailDup()
933 const MachineBasicBlock *BB, in isTrellis()
934 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs, in isTrellis()
941 SmallPtrSet<const MachineBasicBlock *, 2> Successors(BB->succ_begin(), in isTrellis()
944 SmallPtrSet<const MachineBasicBlock *, 8> SeenPreds; in isTrellis()
946 for (MachineBasicBlock *Succ : ViableSuccs) { in isTrellis()
952 for (MachineBasicBlock *CheckSucc : SuccPred->successors()) in isTrellis()
984 const MachineBasicBlock *BB, in getBestNonConflictingEdges()
1028 const MachineBasicBlock *BB, in getBestTrellisSuccessor()
1029 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs, in getBestTrellisSuccessor()
1034 SmallPtrSet<const MachineBasicBlock *, 4> Successors(BB->succ_begin(), in getBestTrellisSuccessor()
1047 for (MachineBasicBlock *SuccPred : Succ->predecessors()) { in getBestTrellisSuccessor()
1079 MachineBasicBlock *Succ1 = BestA.Dest; in getBestTrellisSuccessor()
1080 MachineBasicBlock *Succ2 = BestB.Dest; in getBestTrellisSuccessor()
1113 const MachineBasicBlock *BB, MachineBasicBlock *Succ, in canTailDuplicateUnplacedPreds()
1124 SmallPtrSet<const MachineBasicBlock *, 4> Successors(BB->succ_begin(), in canTailDuplicateUnplacedPreds()
1126 for (MachineBasicBlock *Pred : Succ->predecessors()) { in canTailDuplicateUnplacedPreds()
1237 std::vector<MachineBasicBlock *> Edges; in precomputeTriangleChains()
1239 TriangleChain(MachineBasicBlock *src, MachineBasicBlock *dst) in precomputeTriangleChains()
1242 void append(MachineBasicBlock *dst) { in precomputeTriangleChains()
1250 MachineBasicBlock *getKey() const { in precomputeTriangleChains()
1261 DenseMap<const MachineBasicBlock *, TriangleChain> TriangleChainMap; in precomputeTriangleChains()
1262 for (MachineBasicBlock &BB : *F) { in precomputeTriangleChains()
1266 MachineBasicBlock *PDom = nullptr; in precomputeTriangleChains()
1267 for (MachineBasicBlock *Succ : BB.successors()) { in precomputeTriangleChains()
1287 for (MachineBasicBlock* Pred : PDom->predecessors()) { in precomputeTriangleChains()
1329 MachineBasicBlock *dst = Chain.Edges.back(); in precomputeTriangleChains()
1331 for (MachineBasicBlock *src : reverse(Chain.Edges)) { in precomputeTriangleChains()
1348 const MachineBasicBlock *BB) { in getLayoutSuccessorProbThreshold()
1352 const MachineBasicBlock *Succ1 = *BB->succ_begin(); in getLayoutSuccessorProbThreshold()
1353 const MachineBasicBlock *Succ2 = *(BB->succ_begin() + 1); in getLayoutSuccessorProbThreshold()
1380 const MachineBasicBlock *BB, const MachineBasicBlock *Succ, in hasBetterLayoutPredecessor()
1509 for (MachineBasicBlock *Pred : Succ->predecessors()) { in hasBetterLayoutPredecessor()
1561 const MachineBasicBlock *BB, const BlockChain &Chain, in selectBestSuccessor()
1568 SmallVector<MachineBasicBlock *, 4> Successors; in selectBestSuccessor()
1579 MachineBasicBlock *Succ = FoundEdge->second.BB; in selectBestSuccessor()
1596 SmallVector<std::pair<BranchProbability, MachineBasicBlock *>, 4> in selectBestSuccessor()
1598 for (MachineBasicBlock *Succ : Successors) { in selectBestSuccessor()
1635 [](std::tuple<BranchProbability, MachineBasicBlock *> L, in selectBestSuccessor()
1636 std::tuple<BranchProbability, MachineBasicBlock *> R) { in selectBestSuccessor()
1641 MachineBasicBlock *Succ; in selectBestSuccessor()
1672 MachineBasicBlock *MachineBlockPlacement::selectBestCandidateBlock( in selectBestCandidateBlock()
1673 const BlockChain &Chain, SmallVectorImpl<MachineBasicBlock *> &WorkList) { in selectBestCandidateBlock()
1678 llvm::erase_if(WorkList, [&](MachineBasicBlock *BB) { in selectBestCandidateBlock()
1687 MachineBasicBlock *BestBlock = nullptr; in selectBestCandidateBlock()
1689 for (MachineBasicBlock *MBB : WorkList) { in selectBestCandidateBlock()
1739 MachineBasicBlock *MachineBlockPlacement::getFirstUnplacedBlock( in getFirstUnplacedBlock()
1759 const MachineBasicBlock *MBB, in fillWorkLists()
1769 for (MachineBasicBlock *ChainBB : Chain) { in fillWorkLists()
1772 for (MachineBasicBlock *Pred : ChainBB->predecessors()) { in fillWorkLists()
1784 MachineBasicBlock *BB = *Chain.begin(); in fillWorkLists()
1792 const MachineBasicBlock *HeadBB, BlockChain &Chain, in buildChain()
1798 const MachineBasicBlock *LoopHeaderBB = HeadBB; in buildChain()
1800 MachineBasicBlock *BB = *std::prev(Chain.end()); in buildChain()
1810 MachineBasicBlock* BestSucc = Result.BB; in buildChain()
1877 const MachineBasicBlock *BottomBlock, in canMoveBottomBlockToTop()
1878 const MachineBasicBlock *OldTop) { in canMoveBottomBlockToTop()
1881 MachineBasicBlock *Pred = *BottomBlock->pred_begin(); in canMoveBottomBlockToTop()
1885 MachineBasicBlock *OtherBB = *Pred->succ_begin(); in canMoveBottomBlockToTop()
1897 const MachineBasicBlock *Top, in TopFallThroughFreq()
1900 for (MachineBasicBlock *Pred : Top->predecessors()) { in TopFallThroughFreq()
1908 for (MachineBasicBlock *Succ : Pred->successors()) { in TopFallThroughFreq()
1953 const MachineBasicBlock *NewTop, in FallThroughGains()
1954 const MachineBasicBlock *OldTop, in FallThroughGains()
1955 const MachineBasicBlock *ExitBB, in FallThroughGains()
1966 MachineBasicBlock *BestPred = nullptr; in FallThroughGains()
1968 for (MachineBasicBlock *Pred : NewTop->predecessors()) { in FallThroughGains()
1986 for (MachineBasicBlock *Succ : BestPred->successors()) { in FallThroughGains()
2042 MachineBasicBlock *
2044 MachineBasicBlock *OldTop, in findBestLoopTopHelper()
2058 MachineBasicBlock *BestPred = nullptr; in findBestLoopTopHelper()
2059 for (MachineBasicBlock *Pred : OldTop->predecessors()) { in findBestLoopTopHelper()
2070 MachineBasicBlock *OtherBB = nullptr; in findBestLoopTopHelper()
2109 MachineBasicBlock *
2124 MachineBasicBlock *OldTop = nullptr; in findBestLoopTop()
2125 MachineBasicBlock *NewTop = L.getHeader(); in findBestLoopTop()
2140 MachineBasicBlock *
2158 MachineBasicBlock *ExitingBB = nullptr; in findBestLoopExit()
2162 SmallPtrSet<MachineBasicBlock *, 4> BlocksExitingToOuterLoop; in findBestLoopExit()
2166 for (MachineBasicBlock *MBB : L.getBlocks()) { in findBestLoopExit()
2177 MachineBasicBlock *OldExitingBB = ExitingBB; in findBestLoopExit()
2180 for (MachineBasicBlock *Succ : MBB->successors()) { in findBestLoopExit()
2264 const MachineBasicBlock *Top, in hasViableTopFallthrough()
2266 for (MachineBasicBlock *Pred : Top->predecessors()) { in hasViableTopFallthrough()
2274 for (MachineBasicBlock *Succ : Pred->successors()) { in hasViableTopFallthrough()
2298 const MachineBasicBlock *ExitingBB, in rotateLoop()
2304 MachineBasicBlock *Top = *LoopChain.begin(); in rotateLoop()
2305 MachineBasicBlock *Bottom = *std::prev(LoopChain.end()); in rotateLoop()
2321 for (MachineBasicBlock *Succ : Bottom->successors()) { in rotateLoop()
2361 MachineBasicBlock *NextBlockInChain = *std::next(ExitIt); in rotateLoop()
2389 MachineBasicBlock *ChainHeaderBB = *LoopChain.begin(); in rotateLoopWithProfile()
2431 SmallVector<std::pair<MachineBasicBlock *, BlockFrequency>, 4> ExitsWithFreq; in rotateLoopWithProfile()
2547 for (MachineBasicBlock *LoopBB : L.getBlocks()) { in collectLoopBlockSet()
2554 for (MachineBasicBlock *ChainBB : *Chain) in collectLoopBlockSet()
2592 MachineBasicBlock *LoopTop = findBestLoopTop(L, LoopBlockSet); in buildLoopChains()
2615 for (const MachineBasicBlock *LoopBB : LoopBlockSet) in buildLoopChains()
2634 for (MachineBasicBlock *ChainBB : LoopChain) { in buildLoopChains()
2649 for (const MachineBasicBlock *LoopBB : LoopBlockSet) in buildLoopChains()
2668 MachineBasicBlock *BB = &*FI; in buildCFGChains()
2675 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in buildCFGChains()
2680 MachineBasicBlock *NextBB = &*NextFI; in buildCFGChains()
2707 for (MachineBasicBlock &MBB : *F) in buildCFGChains()
2714 using FunctionBlockSetType = SmallPtrSet<MachineBasicBlock *, 16>; in buildCFGChains()
2720 for (MachineBasicBlock &MBB : *F) in buildCFGChains()
2723 for (MachineBasicBlock *ChainBB : FunctionChain) in buildCFGChains()
2732 for (MachineBasicBlock *RemainingBB : FunctionBlockSet) in buildCFGChains()
2741 SmallVector<MachineBasicBlock *, 4> OriginalLayoutSuccessors( in buildCFGChains()
2744 MachineBasicBlock *LastMBB = nullptr; in buildCFGChains()
2756 for (MachineBasicBlock *ChainBB : FunctionChain) { in buildCFGChains()
2768 MachineBasicBlock *PrevBB = &*std::prev(MachineFunction::iterator(ChainBB)); in buildCFGChains()
2774 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in buildCFGChains()
2817 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in buildCFGChains()
2819 MachineBasicBlock *PrevBB = &F->back(); in buildCFGChains()
2837 for (MachineBasicBlock *ChainBB : FunctionChain) { in optimizeBranches()
2839 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in optimizeBranches()
2876 for (MachineBasicBlock *ChainBB : FunctionChain) { in alignBlocks()
2900 MachineBasicBlock *LoopHeader = L->getHeader(); in alignBlocks()
2912 MachineBasicBlock *LayoutPred = in alignBlocks()
2950 MachineBasicBlock *BB, MachineBasicBlock *&LPred, in repeatedlyTailDuplicateBlock()
2951 const MachineBasicBlock *LoopHeaderBB, in repeatedlyTailDuplicateBlock()
2967 MachineBasicBlock *DupBB, *DupPred; in repeatedlyTailDuplicateBlock()
3008 MachineBasicBlock *BB, MachineBasicBlock *LPred, in maybeTailDuplicateBlock()
3023 [&](MachineBasicBlock *RemBB) { in maybeTailDuplicateBlock()
3044 SmallVectorImpl<MachineBasicBlock *> &RemoveList = BlockWorkList; in maybeTailDuplicateBlock()
3064 function_ref<void(MachineBasicBlock*)>(RemovalCallback); in maybeTailDuplicateBlock()
3066 SmallVector<MachineBasicBlock *, 8> DuplicatedPreds; in maybeTailDuplicateBlock()
3068 SmallVector<MachineBasicBlock *, 8> CandidatePreds; in maybeTailDuplicateBlock()
3069 SmallVectorImpl<MachineBasicBlock *> *CandidatePtr = nullptr; in maybeTailDuplicateBlock()
3083 for (MachineBasicBlock *Pred : DuplicatedPreds) { in maybeTailDuplicateBlock()
3091 for (MachineBasicBlock *NewSucc : Pred->successors()) { in maybeTailDuplicateBlock()
3103 static uint64_t countMBBInstruction(MachineBasicBlock *MBB) { in countMBBInstruction()
3115 BlockFrequency MachineBlockPlacement::scaleThreshold(MachineBasicBlock *BB) { in scaleThreshold()
3120 bool MachineBlockPlacement::isBestSuccessor(MachineBasicBlock *BB, in isBestSuccessor()
3121 MachineBasicBlock *Pred, in isBestSuccessor()
3133 for (MachineBasicBlock *Succ : Pred->successors()) in isBestSuccessor()
3159 SmallVectorImpl<MachineBasicBlock *> &Candidates, in findDuplicateCandidates()
3160 MachineBasicBlock *BB, in findDuplicateCandidates()
3162 MachineBasicBlock *Fallthrough = nullptr; in findDuplicateCandidates()
3165 SmallVector<MachineBasicBlock *, 8> Preds(BB->predecessors()); in findDuplicateCandidates()
3166 SmallVector<MachineBasicBlock *, 8> Succs(BB->successors()); in findDuplicateCandidates()
3169 auto CmpSucc = [&](MachineBasicBlock *A, MachineBasicBlock *B) { in findDuplicateCandidates()
3172 auto CmpPred = [&](MachineBasicBlock *A, MachineBasicBlock *B) { in findDuplicateCandidates()
3224 for (MachineBasicBlock *Pred : Preds) { in findDuplicateCandidates()
3284 for (MachineBasicBlock &MBB : *F) { in initDupThreshold()
3397 for (MachineBasicBlock &MBB : MF) in runOnMachineFunction()
3473 for (MachineBasicBlock &MBB : F) { in INITIALIZE_PASS_DEPENDENCY()
3479 for (MachineBasicBlock *Succ : MBB.successors()) { in INITIALIZE_PASS_DEPENDENCY()