Lines Matching refs:MachineBasicBlock

237 using BlockToChainMapType = DenseMap<const MachineBasicBlock *, BlockChain *>;
255 SmallVector<MachineBasicBlock *, 4> Blocks;
271 BlockChain(BlockToChainMapType &BlockToChain, MachineBasicBlock *BB) in BlockChain()
278 using iterator = SmallVectorImpl<MachineBasicBlock *>::iterator;
279 using const_iterator = SmallVectorImpl<MachineBasicBlock *>::const_iterator;
289 bool remove(MachineBasicBlock* BB) { in remove()
305 void merge(MachineBasicBlock *BB, BlockChain *Chain) { in merge()
323 for (MachineBasicBlock *ChainBB : *Chain) { in merge()
333 for (MachineBasicBlock *MBB : *this) in dump()
352 using BlockFilterSet = SmallSetVector<const MachineBasicBlock *, 16>;
356 MachineBasicBlock *BB = nullptr;
363 MachineBasicBlock *Src = nullptr;
364 MachineBasicBlock *Dest = nullptr;
368 SmallVector<MachineBasicBlock *, 16> BlockWorkList;
369 SmallVector<MachineBasicBlock *, 16> EHPadWorkList;
372 DenseMap<const MachineBasicBlock *, BlockAndTailDupResult> ComputedEdges;
389 MachineBasicBlock *PreferredLoopExit = nullptr;
431 DenseMap<const MachineBasicBlock *, BlockChain *> BlockToChain;
438 SmallPtrSet<MachineBasicBlock *, 4> BlocksWithUnanalyzableExits;
443 BlockFrequency getBlockCountOrFrequency(const MachineBasicBlock *BB) { in getBlockCountOrFrequency()
455 BlockFrequency scaleThreshold(MachineBasicBlock *BB);
461 const BlockChain &Chain, const MachineBasicBlock *LoopHeaderBB,
467 const BlockChain &Chain, const MachineBasicBlock *BB,
468 const MachineBasicBlock *LoopHeaderBB,
473 const MachineBasicBlock *BB, const BlockChain &Chain,
475 SmallVector<MachineBasicBlock *, 4> &Successors);
476 bool isBestSuccessor(MachineBasicBlock *BB, MachineBasicBlock *Pred,
478 void findDuplicateCandidates(SmallVectorImpl<MachineBasicBlock *> &Candidates,
479 MachineBasicBlock *BB,
482 MachineBasicBlock *BB, MachineBasicBlock *&LPred,
483 const MachineBasicBlock *LoopHeaderBB,
487 MachineBasicBlock *BB, MachineBasicBlock *LPred,
492 const MachineBasicBlock *BB, const MachineBasicBlock *Succ,
497 const MachineBasicBlock *BB, const BlockChain &Chain,
499 MachineBasicBlock *selectBestCandidateBlock(
500 const BlockChain &Chain, SmallVectorImpl<MachineBasicBlock *> &WorkList);
501 MachineBasicBlock *getFirstUnplacedBlock(
511 void fillWorkLists(const MachineBasicBlock *MBB,
515 void buildChain(const MachineBasicBlock *BB, BlockChain &Chain,
517 bool canMoveBottomBlockToTop(const MachineBasicBlock *BottomBlock,
518 const MachineBasicBlock *OldTop);
519 bool hasViableTopFallthrough(const MachineBasicBlock *Top,
521 BlockFrequency TopFallThroughFreq(const MachineBasicBlock *Top,
523 BlockFrequency FallThroughGains(const MachineBasicBlock *NewTop,
524 const MachineBasicBlock *OldTop,
525 const MachineBasicBlock *ExitBB,
527 MachineBasicBlock *findBestLoopTopHelper(MachineBasicBlock *OldTop,
529 MachineBasicBlock *findBestLoopTop(
531 MachineBasicBlock *findBestLoopExit(
537 BlockChain &LoopChain, const MachineBasicBlock *ExitingBB,
547 bool shouldTailDuplicate(MachineBasicBlock *BB);
551 const MachineBasicBlock *BB, const MachineBasicBlock *Succ,
556 bool isTrellis(const MachineBasicBlock *BB,
557 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs,
562 const MachineBasicBlock *BB,
563 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs,
569 const MachineBasicBlock *BB,
575 const MachineBasicBlock *BB, MachineBasicBlock *Succ,
586 void assignBlockOrder(const std::vector<const MachineBasicBlock *> &NewOrder);
637 static std::string getBlockName(const MachineBasicBlock *BB) { in INITIALIZE_PASS_DEPENDENCY()
654 const BlockChain &Chain, const MachineBasicBlock *LoopHeaderBB, in markChainSuccessors()
658 for (MachineBasicBlock *MBB : Chain) { in markChainSuccessors()
670 const BlockChain &Chain, const MachineBasicBlock *MBB, in markBlockSuccessors()
671 const MachineBasicBlock *LoopHeaderBB, const BlockFilterSet *BlockFilter) { in markBlockSuccessors()
676 for (MachineBasicBlock *Succ : MBB->successors()) { in markBlockSuccessors()
703 const MachineBasicBlock *BB, const BlockChain &Chain, in collectViableSuccessors()
705 SmallVector<MachineBasicBlock *, 4> &Successors) { in collectViableSuccessors() argument
723 for (MachineBasicBlock *Succ : BB->successors()) { in collectViableSuccessors()
764 hasSameSuccessors(MachineBasicBlock &BB, in hasSameSuccessors()
765 SmallPtrSetImpl<const MachineBasicBlock *> &Successors) { in hasSameSuccessors()
771 for (MachineBasicBlock *Succ : BB.successors()) in hasSameSuccessors()
780 bool MachineBlockPlacement::shouldTailDuplicate(MachineBasicBlock *BB) { in shouldTailDuplicate()
810 const MachineBasicBlock *BB, const MachineBasicBlock *Succ, in isProfitableToTailDup()
836 MachineBasicBlock *PDom = nullptr; in isProfitableToTailDup()
837 SmallVector<MachineBasicBlock *, 4> SuccSuccs; in isProfitableToTailDup()
854 for (MachineBasicBlock *SuccSucc : SuccSuccs) { in isProfitableToTailDup()
867 for (MachineBasicBlock *SuccPred : Succ->predecessors()) { in isProfitableToTailDup()
964 const MachineBasicBlock *BB, in isTrellis()
965 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs, in isTrellis()
972 SmallPtrSet<const MachineBasicBlock *, 2> Successors(BB->succ_begin(), in isTrellis()
975 SmallPtrSet<const MachineBasicBlock *, 8> SeenPreds; in isTrellis()
977 for (MachineBasicBlock *Succ : ViableSuccs) { in isTrellis()
983 for (MachineBasicBlock *CheckSucc : SuccPred->successors()) in isTrellis()
1015 const MachineBasicBlock *BB, in getBestNonConflictingEdges()
1059 const MachineBasicBlock *BB, in getBestTrellisSuccessor()
1060 const SmallVectorImpl<MachineBasicBlock *> &ViableSuccs, in getBestTrellisSuccessor()
1065 SmallPtrSet<const MachineBasicBlock *, 4> Successors(BB->succ_begin(), in getBestTrellisSuccessor()
1078 for (MachineBasicBlock *SuccPred : Succ->predecessors()) { in getBestTrellisSuccessor()
1110 MachineBasicBlock *Succ1 = BestA.Dest; in getBestTrellisSuccessor()
1111 MachineBasicBlock *Succ2 = BestB.Dest; in getBestTrellisSuccessor()
1144 const MachineBasicBlock *BB, MachineBasicBlock *Succ, in canTailDuplicateUnplacedPreds()
1155 SmallPtrSet<const MachineBasicBlock *, 4> Successors(BB->succ_begin(), in canTailDuplicateUnplacedPreds()
1157 for (MachineBasicBlock *Pred : Succ->predecessors()) { in canTailDuplicateUnplacedPreds()
1268 std::vector<MachineBasicBlock *> Edges; in precomputeTriangleChains()
1270 TriangleChain(MachineBasicBlock *src, MachineBasicBlock *dst) in precomputeTriangleChains()
1273 void append(MachineBasicBlock *dst) { in precomputeTriangleChains()
1281 MachineBasicBlock *getKey() const { in precomputeTriangleChains()
1292 DenseMap<const MachineBasicBlock *, TriangleChain> TriangleChainMap; in precomputeTriangleChains()
1293 for (MachineBasicBlock &BB : *F) { in precomputeTriangleChains()
1297 MachineBasicBlock *PDom = nullptr; in precomputeTriangleChains()
1298 for (MachineBasicBlock *Succ : BB.successors()) { in precomputeTriangleChains()
1318 for (MachineBasicBlock* Pred : PDom->predecessors()) { in precomputeTriangleChains()
1360 MachineBasicBlock *dst = Chain.Edges.back(); in precomputeTriangleChains()
1362 for (MachineBasicBlock *src : reverse(Chain.Edges)) { in precomputeTriangleChains()
1379 const MachineBasicBlock *BB) { in getLayoutSuccessorProbThreshold()
1383 const MachineBasicBlock *Succ1 = *BB->succ_begin(); in getLayoutSuccessorProbThreshold()
1384 const MachineBasicBlock *Succ2 = *(BB->succ_begin() + 1); in getLayoutSuccessorProbThreshold()
1411 const MachineBasicBlock *BB, const MachineBasicBlock *Succ, in hasBetterLayoutPredecessor()
1540 for (MachineBasicBlock *Pred : Succ->predecessors()) { in hasBetterLayoutPredecessor()
1592 const MachineBasicBlock *BB, const BlockChain &Chain, in selectBestSuccessor()
1599 SmallVector<MachineBasicBlock *, 4> Successors; in selectBestSuccessor()
1610 MachineBasicBlock *Succ = FoundEdge->second.BB; in selectBestSuccessor()
1627 SmallVector<std::pair<BranchProbability, MachineBasicBlock *>, 4> in selectBestSuccessor()
1629 for (MachineBasicBlock *Succ : Successors) { in selectBestSuccessor()
1666 [](std::tuple<BranchProbability, MachineBasicBlock *> L, in selectBestSuccessor()
1667 std::tuple<BranchProbability, MachineBasicBlock *> R) { in selectBestSuccessor()
1672 MachineBasicBlock *Succ; in selectBestSuccessor()
1703 MachineBasicBlock *MachineBlockPlacement::selectBestCandidateBlock( in selectBestCandidateBlock()
1704 const BlockChain &Chain, SmallVectorImpl<MachineBasicBlock *> &WorkList) { in selectBestCandidateBlock()
1709 llvm::erase_if(WorkList, [&](MachineBasicBlock *BB) { in selectBestCandidateBlock()
1718 MachineBasicBlock *BestBlock = nullptr; in selectBestCandidateBlock()
1720 for (MachineBasicBlock *MBB : WorkList) { in selectBestCandidateBlock()
1771 MachineBasicBlock *MachineBlockPlacement::getFirstUnplacedBlock( in getFirstUnplacedBlock()
1791 const MachineBasicBlock *MBB, in fillWorkLists()
1801 for (MachineBasicBlock *ChainBB : Chain) { in fillWorkLists()
1804 for (MachineBasicBlock *Pred : ChainBB->predecessors()) { in fillWorkLists()
1816 MachineBasicBlock *BB = *Chain.begin(); in fillWorkLists()
1824 const MachineBasicBlock *HeadBB, BlockChain &Chain, in buildChain()
1830 const MachineBasicBlock *LoopHeaderBB = HeadBB; in buildChain()
1832 MachineBasicBlock *BB = *std::prev(Chain.end()); in buildChain()
1842 MachineBasicBlock* BestSucc = Result.BB; in buildChain()
1909 const MachineBasicBlock *BottomBlock, in canMoveBottomBlockToTop()
1910 const MachineBasicBlock *OldTop) { in canMoveBottomBlockToTop()
1913 MachineBasicBlock *Pred = *BottomBlock->pred_begin(); in canMoveBottomBlockToTop()
1917 MachineBasicBlock *OtherBB = *Pred->succ_begin(); in canMoveBottomBlockToTop()
1929 const MachineBasicBlock *Top, in TopFallThroughFreq()
1932 for (MachineBasicBlock *Pred : Top->predecessors()) { in TopFallThroughFreq()
1940 for (MachineBasicBlock *Succ : Pred->successors()) { in TopFallThroughFreq()
1985 const MachineBasicBlock *NewTop, in FallThroughGains()
1986 const MachineBasicBlock *OldTop, in FallThroughGains()
1987 const MachineBasicBlock *ExitBB, in FallThroughGains()
1998 MachineBasicBlock *BestPred = nullptr; in FallThroughGains()
2000 for (MachineBasicBlock *Pred : NewTop->predecessors()) { in FallThroughGains()
2018 for (MachineBasicBlock *Succ : BestPred->successors()) { in FallThroughGains()
2074 MachineBasicBlock *
2076 MachineBasicBlock *OldTop, in findBestLoopTopHelper()
2092 MachineBasicBlock *BestPred = nullptr; in findBestLoopTopHelper()
2093 for (MachineBasicBlock *Pred : OldTop->predecessors()) { in findBestLoopTopHelper()
2104 MachineBasicBlock *OtherBB = nullptr; in findBestLoopTopHelper()
2144 MachineBasicBlock *
2159 MachineBasicBlock *OldTop = nullptr; in findBestLoopTop()
2160 MachineBasicBlock *NewTop = L.getHeader(); in findBestLoopTop()
2175 MachineBasicBlock *
2193 MachineBasicBlock *ExitingBB = nullptr; in findBestLoopExit()
2197 SmallPtrSet<MachineBasicBlock *, 4> BlocksExitingToOuterLoop; in findBestLoopExit()
2201 for (MachineBasicBlock *MBB : L.getBlocks()) { in findBestLoopExit()
2212 MachineBasicBlock *OldExitingBB = ExitingBB; in findBestLoopExit()
2215 for (MachineBasicBlock *Succ : MBB->successors()) { in findBestLoopExit()
2299 const MachineBasicBlock *Top, in hasViableTopFallthrough()
2301 for (MachineBasicBlock *Pred : Top->predecessors()) { in hasViableTopFallthrough()
2309 for (MachineBasicBlock *Succ : Pred->successors()) { in hasViableTopFallthrough()
2333 const MachineBasicBlock *ExitingBB, in rotateLoop()
2339 MachineBasicBlock *Top = *LoopChain.begin(); in rotateLoop()
2340 MachineBasicBlock *Bottom = *std::prev(LoopChain.end()); in rotateLoop()
2356 for (MachineBasicBlock *Succ : Bottom->successors()) { in rotateLoop()
2396 MachineBasicBlock *NextBlockInChain = *std::next(ExitIt); in rotateLoop()
2424 MachineBasicBlock *ChainHeaderBB = *LoopChain.begin(); in rotateLoopWithProfile()
2466 SmallVector<std::pair<MachineBasicBlock *, BlockFrequency>, 4> ExitsWithFreq; in rotateLoopWithProfile()
2581 for (MachineBasicBlock *LoopBB : L.getBlocks()) { in collectLoopBlockSet()
2588 for (MachineBasicBlock *ChainBB : *Chain) in collectLoopBlockSet()
2626 MachineBasicBlock *LoopTop = findBestLoopTop(L, LoopBlockSet); in buildLoopChains()
2649 for (const MachineBasicBlock *LoopBB : LoopBlockSet) in buildLoopChains()
2668 for (MachineBasicBlock *ChainBB : LoopChain) { in buildLoopChains()
2683 for (const MachineBasicBlock *LoopBB : LoopBlockSet) in buildLoopChains()
2702 MachineBasicBlock *BB = &*FI; in buildCFGChains()
2709 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in buildCFGChains()
2714 MachineBasicBlock *NextBB = &*NextFI; in buildCFGChains()
2741 for (MachineBasicBlock &MBB : *F) in buildCFGChains()
2748 using FunctionBlockSetType = SmallPtrSet<MachineBasicBlock *, 16>; in buildCFGChains()
2754 for (MachineBasicBlock &MBB : *F) in buildCFGChains()
2757 for (MachineBasicBlock *ChainBB : FunctionChain) in buildCFGChains()
2766 for (MachineBasicBlock *RemainingBB : FunctionBlockSet) in buildCFGChains()
2775 SmallVector<MachineBasicBlock *, 4> OriginalLayoutSuccessors( in buildCFGChains()
2778 MachineBasicBlock *LastMBB = nullptr; in buildCFGChains()
2790 for (MachineBasicBlock *ChainBB : FunctionChain) { in buildCFGChains()
2802 MachineBasicBlock *PrevBB = &*std::prev(MachineFunction::iterator(ChainBB)); in buildCFGChains()
2808 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in buildCFGChains()
2851 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in buildCFGChains()
2853 MachineBasicBlock *PrevBB = &F->back(); in buildCFGChains()
2871 for (MachineBasicBlock *ChainBB : FunctionChain) { in optimizeBranches()
2873 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For analyzeBranch. in optimizeBranches()
2910 for (MachineBasicBlock *ChainBB : FunctionChain) { in alignBlocks()
2956 MachineBasicBlock *LoopHeader = L->getHeader(); in alignBlocks()
2968 MachineBasicBlock *LayoutPred = in alignBlocks()
3019 MachineBasicBlock *BB, MachineBasicBlock *&LPred, in repeatedlyTailDuplicateBlock()
3020 const MachineBasicBlock *LoopHeaderBB, in repeatedlyTailDuplicateBlock()
3036 MachineBasicBlock *DupBB, *DupPred; in repeatedlyTailDuplicateBlock()
3077 MachineBasicBlock *BB, MachineBasicBlock *LPred, in maybeTailDuplicateBlock()
3092 [&](MachineBasicBlock *RemBB) { in maybeTailDuplicateBlock()
3113 SmallVectorImpl<MachineBasicBlock *> &RemoveList = BlockWorkList; in maybeTailDuplicateBlock()
3133 function_ref<void(MachineBasicBlock*)>(RemovalCallback); in maybeTailDuplicateBlock()
3135 SmallVector<MachineBasicBlock *, 8> DuplicatedPreds; in maybeTailDuplicateBlock()
3137 SmallVector<MachineBasicBlock *, 8> CandidatePreds; in maybeTailDuplicateBlock()
3138 SmallVectorImpl<MachineBasicBlock *> *CandidatePtr = nullptr; in maybeTailDuplicateBlock()
3152 for (MachineBasicBlock *Pred : DuplicatedPreds) { in maybeTailDuplicateBlock()
3160 for (MachineBasicBlock *NewSucc : Pred->successors()) { in maybeTailDuplicateBlock()
3172 static uint64_t countMBBInstruction(MachineBasicBlock *MBB) { in countMBBInstruction()
3184 BlockFrequency MachineBlockPlacement::scaleThreshold(MachineBasicBlock *BB) { in scaleThreshold()
3189 bool MachineBlockPlacement::isBestSuccessor(MachineBasicBlock *BB, in isBestSuccessor()
3190 MachineBasicBlock *Pred, in isBestSuccessor()
3202 for (MachineBasicBlock *Succ : Pred->successors()) in isBestSuccessor()
3228 SmallVectorImpl<MachineBasicBlock *> &Candidates, in findDuplicateCandidates()
3229 MachineBasicBlock *BB, in findDuplicateCandidates()
3231 MachineBasicBlock *Fallthrough = nullptr; in findDuplicateCandidates()
3234 SmallVector<MachineBasicBlock *, 8> Preds(BB->predecessors()); in findDuplicateCandidates()
3235 SmallVector<MachineBasicBlock *, 8> Succs(BB->successors()); in findDuplicateCandidates()
3238 auto CmpSucc = [&](MachineBasicBlock *A, MachineBasicBlock *B) { in findDuplicateCandidates()
3241 auto CmpPred = [&](MachineBasicBlock *A, MachineBasicBlock *B) { in findDuplicateCandidates()
3293 for (MachineBasicBlock *Pred : Preds) { in findDuplicateCandidates()
3354 for (MachineBasicBlock &MBB : *F) { in initDupThreshold()
3480 for (MachineBasicBlock &MBB : MF) { in runOnMachineFunction()
3516 DenseMap<const MachineBasicBlock *, uint64_t> BlockIndex; in applyExtTsp()
3518 std::vector<const MachineBasicBlock *> CurrentBlockOrder; in applyExtTsp()
3521 for (const MachineBasicBlock &MBB : *F) { in applyExtTsp()
3529 for (MachineBasicBlock &MBB : *F) { in applyExtTsp()
3544 for (MachineBasicBlock *Succ : MBB.successors()) { in applyExtTsp()
3562 std::vector<const MachineBasicBlock *> NewBlockOrder; in applyExtTsp()
3576 const std::vector<const MachineBasicBlock *> &NewBlockOrder) { in assignBlockOrder()
3591 SmallVector<MachineBasicBlock *, 4> PrevFallThroughs(F->getNumBlockIDs()); in assignBlockOrder()
3597 DenseMap<const MachineBasicBlock *, size_t> NewIndex; in assignBlockOrder()
3598 for (const MachineBasicBlock *MBB : NewBlockOrder) { in assignBlockOrder()
3601 F->sort([&](MachineBasicBlock &L, MachineBasicBlock &R) { in assignBlockOrder()
3622 MachineBasicBlock *TBB = nullptr, *FBB = nullptr; in assignBlockOrder()
3639 MachineBasicBlock *HeadBB = &F->front(); in createCFGChainExtTsp()
3643 for (MachineBasicBlock &MBB : *F) { in createCFGChainExtTsp()
3706 for (MachineBasicBlock &MBB : F) { in INITIALIZE_PASS_DEPENDENCY()
3712 for (MachineBasicBlock *Succ : MBB.successors()) { in INITIALIZE_PASS_DEPENDENCY()