Lines Matching refs:MachineBasicBlock

226 using BlockToChainMapType = DenseMap<const MachineBasicBlock *, BlockChain *>;
244 SmallVector<MachineBasicBlock *, 4> Blocks;
260 BlockChain(BlockToChainMapType &BlockToChain, MachineBasicBlock *BB) in BlockChain()
267 using iterator = SmallVectorImpl<MachineBasicBlock *>::iterator;
268 using const_iterator = SmallVectorImpl<MachineBasicBlock *>::const_iterator;
278 bool remove(MachineBasicBlock* BB) { in remove()
294 void merge(MachineBasicBlock *BB, BlockChain *Chain) { in merge()
312 for (MachineBasicBlock *ChainBB : *Chain) { in merge()
322 for (MachineBasicBlock *MBB : *this) in dump()
341 using BlockFilterSet = SmallSetVector<const MachineBasicBlock *, 16>;
345 MachineBasicBlock *BB;
352 MachineBasicBlock *Src;
353 MachineBasicBlock *Dest;
357 SmallVector<MachineBasicBlock *, 16> BlockWorkList;
358 SmallVector<MachineBasicBlock *, 16> EHPadWorkList;
361 DenseMap<const MachineBasicBlock *, BlockAndTailDupResult> ComputedEdges;
378 MachineBasicBlock *PreferredLoopExit;
420 DenseMap<const MachineBasicBlock *, BlockChain *> BlockToChain;
427 SmallPtrSet<MachineBasicBlock *, 4> BlocksWithUnanalyzableExits;
432 BlockFrequency getBlockCountOrFrequency(const MachineBasicBlock *BB) { in getBlockCountOrFrequency()
444 BlockFrequency scaleThreshold(MachineBasicBlock *BB);
450 const BlockChain &Chain, const MachineBasicBlock *LoopHeaderBB,
456 const BlockChain &Chain, const MachineBasicBlock *BB,
457 const MachineBasicBlock *LoopHeaderBB,
462 const MachineBasicBlock *BB, const BlockChain &Chain,
464 SmallVector<MachineBasicBlock *, 4> &Successors);
465 bool isBestSuccessor(MachineBasicBlock *BB, MachineBasicBlock *Pred,
467 void findDuplicateCandidates(SmallVectorImpl<MachineBasicBlock *> &Candidates,
468 MachineBasicBlock *BB,
471 MachineBasicBlock *BB, MachineBasicBlock *&LPred,
472 const MachineBasicBlock *LoopHeaderBB,
476 MachineBasicBlock *BB, MachineBasicBlock *LPred,
481 const MachineBasicBlock *BB, const MachineBasicBlock *Succ,
486 const MachineBasicBlock *BB, const BlockChain &Chain,
488 MachineBasicBlock *selectBestCandidateBlock(
489 const BlockChain &Chain, SmallVectorImpl<MachineBasicBlock *> &WorkList);
490 MachineBasicBlock *getFirstUnplacedBlock(
500 void fillWorkLists(const MachineBasicBlock *MBB,
504 void buildChain(const MachineBasicBlock *BB, BlockChain &Chain,
506 bool canMoveBottomBlockToTop(const MachineBasicBlock *BottomBlock,
507 const MachineBasicBlock *OldTop);
508 bool hasViableTopFallthrough(const MachineBasicBlock *Top,
510 BlockFrequency TopFallThroughFreq(const MachineBasicBlock *Top,
512 BlockFrequency FallThroughGains(const MachineBasicBlock *NewTop,
513 const MachineBasicBlock *OldTop,
514 const MachineBasicBlock *ExitBB,
516 MachineBasicBlock *findBestLoopTopHelper(MachineBasicBlock *OldTop,
518 MachineBasicBlock *findBestLoopTop(
520 MachineBasicBlock *findBestLoopExit(
526 BlockChain &LoopChain, const MachineBasicBlock *ExitingBB,
536 bool shouldTailDuplicate(MachineBasicBlock *BB);
540 const MachineBasicBlock *BB, const MachineBasicBlock *Succ,
545 bool isTrellis(const MachineBasicBlock *BB,
546 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs,
551 const MachineBasicBlock *BB,
552 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs,
558 const MachineBasicBlock *BB,
564 const MachineBasicBlock *BB, MachineBasicBlock *Succ,
575 void assignBlockOrder(const std::vector<const MachineBasicBlock *> &NewOrder);
626 static std::string getBlockName(const MachineBasicBlock *BB) { in INITIALIZE_PASS_DEPENDENCY()
643 const BlockChain &Chain, const MachineBasicBlock *LoopHeaderBB, in markChainSuccessors()
647 for (MachineBasicBlock *MBB : Chain) { in markChainSuccessors()
659 const BlockChain &Chain, const MachineBasicBlock *MBB, in markBlockSuccessors()
660 const MachineBasicBlock *LoopHeaderBB, const BlockFilterSet *BlockFilter) { in markBlockSuccessors()
665 for (MachineBasicBlock *Succ : MBB->successors()) { in markBlockSuccessors()
692 const MachineBasicBlock *BB, const BlockChain &Chain, in collectViableSuccessors()
694 SmallVector<MachineBasicBlock *, 4> &Successors) { in collectViableSuccessors() argument
712 for (MachineBasicBlock *Succ : BB->successors()) { in collectViableSuccessors()
753 hasSameSuccessors(MachineBasicBlock &BB, in hasSameSuccessors()
754 SmallPtrSetImpl<const MachineBasicBlock *> &Successors) { in hasSameSuccessors()
760 for (MachineBasicBlock *Succ : BB.successors()) in hasSameSuccessors()
769 bool MachineBlockPlacement::shouldTailDuplicate(MachineBasicBlock *BB) { in shouldTailDuplicate()
799 const MachineBasicBlock *BB, const MachineBasicBlock *Succ, in isProfitableToTailDup()
825 MachineBasicBlock *PDom = nullptr; in isProfitableToTailDup()
826 SmallVector<MachineBasicBlock *, 4> SuccSuccs; in isProfitableToTailDup()
843 for (MachineBasicBlock *SuccSucc : SuccSuccs) { in isProfitableToTailDup()
856 for (MachineBasicBlock *SuccPred : Succ->predecessors()) { in isProfitableToTailDup()
953 const MachineBasicBlock *BB, in isTrellis()
954 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs, in isTrellis()
961 SmallPtrSet<const MachineBasicBlock *, 2> Successors(BB->succ_begin(), in isTrellis()
964 SmallPtrSet<const MachineBasicBlock *, 8> SeenPreds; in isTrellis()
966 for (MachineBasicBlock *Succ : ViableSuccs) { in isTrellis()
972 for (MachineBasicBlock *CheckSucc : SuccPred->successors()) in isTrellis()
1004 const MachineBasicBlock *BB, in getBestNonConflictingEdges()
1048 const MachineBasicBlock *BB, in getBestTrellisSuccessor()
1049 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs, in getBestTrellisSuccessor()
1054 SmallPtrSet<const MachineBasicBlock *, 4> Successors(BB->succ_begin(), in getBestTrellisSuccessor()
1067 for (MachineBasicBlock *SuccPred : Succ->predecessors()) { in getBestTrellisSuccessor()
1099 MachineBasicBlock *Succ1 = BestA.Dest; in getBestTrellisSuccessor()
1100 MachineBasicBlock *Succ2 = BestB.Dest; in getBestTrellisSuccessor()
1133 const MachineBasicBlock *BB, MachineBasicBlock *Succ, in canTailDuplicateUnplacedPreds()
1144 SmallPtrSet<const MachineBasicBlock *, 4> Successors(BB->succ_begin(), in canTailDuplicateUnplacedPreds()
1146 for (MachineBasicBlock *Pred : Succ->predecessors()) { in canTailDuplicateUnplacedPreds()
1257 std::vector<MachineBasicBlock *> Edges; in precomputeTriangleChains()
1259 TriangleChain(MachineBasicBlock *src, MachineBasicBlock *dst) in precomputeTriangleChains()
1262 void append(MachineBasicBlock *dst) { in precomputeTriangleChains()
1270 MachineBasicBlock *getKey() const { in precomputeTriangleChains()
1281 DenseMap<const MachineBasicBlock *, TriangleChain> TriangleChainMap; in precomputeTriangleChains()
1282 for (MachineBasicBlock &BB : *F) { in precomputeTriangleChains()
1286 MachineBasicBlock *PDom = nullptr; in precomputeTriangleChains()
1287 for (MachineBasicBlock *Succ : BB.successors()) { in precomputeTriangleChains()
1307 for (MachineBasicBlock* Pred : PDom->predecessors()) { in precomputeTriangleChains()
1349 MachineBasicBlock *dst = Chain.Edges.back(); in precomputeTriangleChains()
1351 for (MachineBasicBlock *src : reverse(Chain.Edges)) { in precomputeTriangleChains()
1368 const MachineBasicBlock *BB) { in getLayoutSuccessorProbThreshold()
1372 const MachineBasicBlock *Succ1 = *BB->succ_begin(); in getLayoutSuccessorProbThreshold()
1373 const MachineBasicBlock *Succ2 = *(BB->succ_begin() + 1); in getLayoutSuccessorProbThreshold()
1400 const MachineBasicBlock *BB, const MachineBasicBlock *Succ, in hasBetterLayoutPredecessor()
1529 for (MachineBasicBlock *Pred : Succ->predecessors()) { in hasBetterLayoutPredecessor()
1581 const MachineBasicBlock *BB, const BlockChain &Chain, in selectBestSuccessor()
1588 SmallVector<MachineBasicBlock *, 4> Successors; in selectBestSuccessor()
1599 MachineBasicBlock *Succ = FoundEdge->second.BB; in selectBestSuccessor()
1616 SmallVector<std::pair<BranchProbability, MachineBasicBlock *>, 4> in selectBestSuccessor()
1618 for (MachineBasicBlock *Succ : Successors) { in selectBestSuccessor()
1655 [](std::tuple<BranchProbability, MachineBasicBlock *> L, in selectBestSuccessor()
1656 std::tuple<BranchProbability, MachineBasicBlock *> R) { in selectBestSuccessor()
1661 MachineBasicBlock *Succ; in selectBestSuccessor()
1692 MachineBasicBlock *MachineBlockPlacement::selectBestCandidateBlock( in selectBestCandidateBlock()
1693 const BlockChain &Chain, SmallVectorImpl<MachineBasicBlock *> &WorkList) { in selectBestCandidateBlock()
1698 llvm::erase_if(WorkList, [&](MachineBasicBlock *BB) { in selectBestCandidateBlock()
1707 MachineBasicBlock *BestBlock = nullptr; in selectBestCandidateBlock()
1709 for (MachineBasicBlock *MBB : WorkList) { in selectBestCandidateBlock()
1759 MachineBasicBlock *MachineBlockPlacement::getFirstUnplacedBlock( in getFirstUnplacedBlock()
1779 const MachineBasicBlock *MBB, in fillWorkLists()
1789 for (MachineBasicBlock *ChainBB : Chain) { in fillWorkLists()
1792 for (MachineBasicBlock *Pred : ChainBB->predecessors()) { in fillWorkLists()
1804 MachineBasicBlock *BB = *Chain.begin(); in fillWorkLists()
1812 const MachineBasicBlock *HeadBB, BlockChain &Chain, in buildChain()
1818 const MachineBasicBlock *LoopHeaderBB = HeadBB; in buildChain()
1820 MachineBasicBlock *BB = *std::prev(Chain.end()); in buildChain()
1830 MachineBasicBlock* BestSucc = Result.BB; in buildChain()
1897 const MachineBasicBlock *BottomBlock, in canMoveBottomBlockToTop()
1898 const MachineBasicBlock *OldTop) { in canMoveBottomBlockToTop()
1901 MachineBasicBlock *Pred = *BottomBlock->pred_begin(); in canMoveBottomBlockToTop()
1905 MachineBasicBlock *OtherBB = *Pred->succ_begin(); in canMoveBottomBlockToTop()
1917 const MachineBasicBlock *Top, in TopFallThroughFreq()
1920 for (MachineBasicBlock *Pred : Top->predecessors()) { in TopFallThroughFreq()
1928 for (MachineBasicBlock *Succ : Pred->successors()) { in TopFallThroughFreq()
1973 const MachineBasicBlock *NewTop, in FallThroughGains()
1974 const MachineBasicBlock *OldTop, in FallThroughGains()
1975 const MachineBasicBlock *ExitBB, in FallThroughGains()
1986 MachineBasicBlock *BestPred = nullptr; in FallThroughGains()
1988 for (MachineBasicBlock *Pred : NewTop->predecessors()) { in FallThroughGains()
2006 for (MachineBasicBlock *Succ : BestPred->successors()) { in FallThroughGains()
2062 MachineBasicBlock *
2064 MachineBasicBlock *OldTop, in findBestLoopTopHelper()
2080 MachineBasicBlock *BestPred = nullptr; in findBestLoopTopHelper()
2081 for (MachineBasicBlock *Pred : OldTop->predecessors()) { in findBestLoopTopHelper()
2092 MachineBasicBlock *OtherBB = nullptr; in findBestLoopTopHelper()
2131 MachineBasicBlock *
2146 MachineBasicBlock *OldTop = nullptr; in findBestLoopTop()
2147 MachineBasicBlock *NewTop = L.getHeader(); in findBestLoopTop()
2162 MachineBasicBlock *
2180 MachineBasicBlock *ExitingBB = nullptr; in findBestLoopExit()
2184 SmallPtrSet<MachineBasicBlock *, 4> BlocksExitingToOuterLoop; in findBestLoopExit()
2188 for (MachineBasicBlock *MBB : L.getBlocks()) { in findBestLoopExit()
2199 MachineBasicBlock *OldExitingBB = ExitingBB; in findBestLoopExit()
2202 for (MachineBasicBlock *Succ : MBB->successors()) { in findBestLoopExit()
2286 const MachineBasicBlock *Top, in hasViableTopFallthrough()
2288 for (MachineBasicBlock *Pred : Top->predecessors()) { in hasViableTopFallthrough()
2296 for (MachineBasicBlock *Succ : Pred->successors()) { in hasViableTopFallthrough()
2320 const MachineBasicBlock *ExitingBB, in rotateLoop()
2326 MachineBasicBlock *Top = *LoopChain.begin(); in rotateLoop()
2327 MachineBasicBlock *Bottom = *std::prev(LoopChain.end()); in rotateLoop()
2343 for (MachineBasicBlock *Succ : Bottom->successors()) { in rotateLoop()
2383 MachineBasicBlock *NextBlockInChain = *std::next(ExitIt); in rotateLoop()
2411 MachineBasicBlock *ChainHeaderBB = *LoopChain.begin(); in rotateLoopWithProfile()
2453 SmallVector<std::pair<MachineBasicBlock *, BlockFrequency>, 4> ExitsWithFreq; in rotateLoopWithProfile()
2569 for (MachineBasicBlock *LoopBB : L.getBlocks()) { in collectLoopBlockSet()
2576 for (MachineBasicBlock *ChainBB : *Chain) in collectLoopBlockSet()
2614 MachineBasicBlock *LoopTop = findBestLoopTop(L, LoopBlockSet); in buildLoopChains()
2637 for (const MachineBasicBlock *LoopBB : LoopBlockSet) in buildLoopChains()
2656 for (MachineBasicBlock *ChainBB : LoopChain) { in buildLoopChains()
2671 for (const MachineBasicBlock *LoopBB : LoopBlockSet) in buildLoopChains()
2690 MachineBasicBlock *BB = &*FI; in buildCFGChains()
2697 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in buildCFGChains()
2702 MachineBasicBlock *NextBB = &*NextFI; in buildCFGChains()
2729 for (MachineBasicBlock &MBB : *F) in buildCFGChains()
2736 using FunctionBlockSetType = SmallPtrSet<MachineBasicBlock *, 16>; in buildCFGChains()
2742 for (MachineBasicBlock &MBB : *F) in buildCFGChains()
2745 for (MachineBasicBlock *ChainBB : FunctionChain) in buildCFGChains()
2754 for (MachineBasicBlock *RemainingBB : FunctionBlockSet) in buildCFGChains()
2763 SmallVector<MachineBasicBlock *, 4> OriginalLayoutSuccessors( in buildCFGChains()
2766 MachineBasicBlock *LastMBB = nullptr; in buildCFGChains()
2778 for (MachineBasicBlock *ChainBB : FunctionChain) { in buildCFGChains()
2790 MachineBasicBlock *PrevBB = &*std::prev(MachineFunction::iterator(ChainBB)); in buildCFGChains()
2796 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in buildCFGChains()
2839 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in buildCFGChains()
2841 MachineBasicBlock *PrevBB = &F->back(); in buildCFGChains()
2859 for (MachineBasicBlock *ChainBB : FunctionChain) { in optimizeBranches()
2861 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in optimizeBranches()
2898 for (MachineBasicBlock *ChainBB : FunctionChain) { in alignBlocks()
2922 MachineBasicBlock *LoopHeader = L->getHeader(); in alignBlocks()
2934 MachineBasicBlock *LayoutPred = in alignBlocks()
2985 MachineBasicBlock *BB, MachineBasicBlock *&LPred, in repeatedlyTailDuplicateBlock()
2986 const MachineBasicBlock *LoopHeaderBB, in repeatedlyTailDuplicateBlock()
3002 MachineBasicBlock *DupBB, *DupPred; in repeatedlyTailDuplicateBlock()
3043 MachineBasicBlock *BB, MachineBasicBlock *LPred, in maybeTailDuplicateBlock()
3058 [&](MachineBasicBlock *RemBB) { in maybeTailDuplicateBlock()
3079 SmallVectorImpl<MachineBasicBlock *> &RemoveList = BlockWorkList; in maybeTailDuplicateBlock()
3099 function_ref<void(MachineBasicBlock*)>(RemovalCallback); in maybeTailDuplicateBlock()
3101 SmallVector<MachineBasicBlock *, 8> DuplicatedPreds; in maybeTailDuplicateBlock()
3103 SmallVector<MachineBasicBlock *, 8> CandidatePreds; in maybeTailDuplicateBlock()
3104 SmallVectorImpl<MachineBasicBlock *> *CandidatePtr = nullptr; in maybeTailDuplicateBlock()
3118 for (MachineBasicBlock *Pred : DuplicatedPreds) { in maybeTailDuplicateBlock()
3126 for (MachineBasicBlock *NewSucc : Pred->successors()) { in maybeTailDuplicateBlock()
3138 static uint64_t countMBBInstruction(MachineBasicBlock *MBB) { in countMBBInstruction()
3150 BlockFrequency MachineBlockPlacement::scaleThreshold(MachineBasicBlock *BB) { in scaleThreshold()
3155 bool MachineBlockPlacement::isBestSuccessor(MachineBasicBlock *BB, in isBestSuccessor()
3156 MachineBasicBlock *Pred, in isBestSuccessor()
3168 for (MachineBasicBlock *Succ : Pred->successors()) in isBestSuccessor()
3194 SmallVectorImpl<MachineBasicBlock *> &Candidates, in findDuplicateCandidates()
3195 MachineBasicBlock *BB, in findDuplicateCandidates()
3197 MachineBasicBlock *Fallthrough = nullptr; in findDuplicateCandidates()
3200 SmallVector<MachineBasicBlock *, 8> Preds(BB->predecessors()); in findDuplicateCandidates()
3201 SmallVector<MachineBasicBlock *, 8> Succs(BB->successors()); in findDuplicateCandidates()
3204 auto CmpSucc = [&](MachineBasicBlock *A, MachineBasicBlock *B) { in findDuplicateCandidates()
3207 auto CmpPred = [&](MachineBasicBlock *A, MachineBasicBlock *B) { in findDuplicateCandidates()
3259 for (MachineBasicBlock *Pred : Preds) { in findDuplicateCandidates()
3319 for (MachineBasicBlock &MBB : *F) { in initDupThreshold()
3445 for (MachineBasicBlock &MBB : MF) { in runOnMachineFunction()
3479 DenseMap<const MachineBasicBlock *, uint64_t> BlockIndex; in applyExtTsp()
3481 std::vector<const MachineBasicBlock *> CurrentBlockOrder; in applyExtTsp()
3484 for (const MachineBasicBlock &MBB : *F) { in applyExtTsp()
3492 for (MachineBasicBlock &MBB : *F) { in applyExtTsp()
3507 for (MachineBasicBlock *Succ : MBB.successors()) { in applyExtTsp()
3525 std::vector<const MachineBasicBlock *> NewBlockOrder; in applyExtTsp()
3539 const std::vector<const MachineBasicBlock *> &NewBlockOrder) { in assignBlockOrder()
3554 SmallVector<MachineBasicBlock *, 4> PrevFallThroughs(F->getNumBlockIDs()); in assignBlockOrder()
3560 DenseMap<const MachineBasicBlock *, size_t> NewIndex; in assignBlockOrder()
3561 for (const MachineBasicBlock *MBB : NewBlockOrder) { in assignBlockOrder()
3564 F->sort([&](MachineBasicBlock &L, MachineBasicBlock &R) { in assignBlockOrder()
3585 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; in assignBlockOrder()
3602 MachineBasicBlock *HeadBB = &F->front(); in createCFGChainExtTsp()
3606 for (MachineBasicBlock &MBB : *F) { in createCFGChainExtTsp()
3669 for (MachineBasicBlock &MBB : F) { in INITIALIZE_PASS_DEPENDENCY()
3675 for (MachineBasicBlock *Succ : MBB.successors()) { in INITIALIZE_PASS_DEPENDENCY()