Lines Matching refs:BasicBlock
160 static bool areLoopExitPHIsLoopInvariant(Loop &L, BasicBlock &ExitingBB, in areLoopExitPHIsLoopInvariant()
161 BasicBlock &ExitBB) { in areLoopExitPHIsLoopInvariant()
178 static void buildPartialUnswitchConditionalBranch(BasicBlock &BB, in buildPartialUnswitchConditionalBranch()
181 BasicBlock &UnswitchedSucc, in buildPartialUnswitchConditionalBranch()
182 BasicBlock &NormalSucc) { in buildPartialUnswitchConditionalBranch()
203 static void rewritePHINodesForUnswitchedExitBlock(BasicBlock &UnswitchedBB, in rewritePHINodesForUnswitchedExitBlock()
204 BasicBlock &OldExitingBB, in rewritePHINodesForUnswitchedExitBlock()
205 BasicBlock &OldPH) { in rewritePHINodesForUnswitchedExitBlock()
225 static void rewritePHINodesForExitAndUnswitchedBlocks(BasicBlock &ExitBB, in rewritePHINodesForExitAndUnswitchedBlocks()
226 BasicBlock &UnswitchedBB, in rewritePHINodesForExitAndUnswitchedBlocks()
227 BasicBlock &OldExitingBB, in rewritePHINodesForExitAndUnswitchedBlocks()
228 BasicBlock &OldPH, in rewritePHINodesForExitAndUnswitchedBlocks()
270 static void hoistLoopToNewParent(Loop &L, BasicBlock &Preheader, in hoistLoopToNewParent()
277 SmallVector<BasicBlock *, 4> Exits; in hoistLoopToNewParent()
314 [&](const BasicBlock *BB) { in hoistLoopToNewParent()
319 for (BasicBlock *BB : L.blocks()) in hoistLoopToNewParent()
435 BasicBlock *OldPH = L.getLoopPreheader(); in unswitchTrivialBranch()
436 BasicBlock *NewPH = SplitEdge(OldPH, L.getHeader(), &DT, &LI, MSSAU); in unswitchTrivialBranch()
442 BasicBlock *UnswitchedBB; in unswitchTrivialBranch()
592 BasicBlock *DefaultExitBB = nullptr; in unswitchTrivialSwitch()
621 SmallVector<std::pair<ConstantInt *, BasicBlock *>, 4> ExitCases; in unswitchTrivialSwitch()
646 BasicBlock *CommonSuccBB = nullptr; in unswitchTrivialSwitch()
666 BasicBlock *OldPH = L.getLoopPreheader(); in unswitchTrivialSwitch()
667 BasicBlock *NewPH = SplitEdge(OldPH, L.getHeader(), &DT, &LI, MSSAU); in unswitchTrivialSwitch()
679 SmallPtrSet<BasicBlock *, 2> UnswitchedExitBBs; in unswitchTrivialSwitch()
680 SmallDenseMap<BasicBlock *, BasicBlock *, 2> SplitExitBBMap; in unswitchTrivialSwitch()
701 BasicBlock *ExitBB = CasePair.second; in unswitchTrivialSwitch()
714 BasicBlock *&SplitExitBB = SplitExitBBMap[ExitBB]; in unswitchTrivialSwitch()
730 BasicBlock *UnswitchedBB = CasePair.second; in unswitchTrivialSwitch()
751 BasicBlock *BB = SI.getParent(); in unswitchTrivialSwitch()
844 BasicBlock *CurrentBB = L.getHeader(); in unswitchAllTrivialConditions()
845 SmallPtrSet<BasicBlock *, 8> Visited; in unswitchAllTrivialConditions()
942 static BasicBlock *buildClonedLoopBlocks( in buildClonedLoopBlocks() argument
943 Loop &L, BasicBlock *LoopPH, BasicBlock *SplitBB, in buildClonedLoopBlocks()
944 ArrayRef<BasicBlock *> ExitBlocks, BasicBlock *ParentBB, in buildClonedLoopBlocks()
945 BasicBlock *UnswitchedSuccBB, BasicBlock *ContinueSuccBB, in buildClonedLoopBlocks()
946 const SmallDenseMap<BasicBlock *, BasicBlock *, 16> &DominatingSucc, in buildClonedLoopBlocks() argument
950 SmallVector<BasicBlock *, 4> NewBlocks; in buildClonedLoopBlocks()
955 auto CloneBlock = [&](BasicBlock *OldBB) { in buildClonedLoopBlocks()
957 BasicBlock *NewBB = CloneBasicBlock(OldBB, VMap, ".us", OldBB->getParent()); in buildClonedLoopBlocks()
969 auto SkipBlock = [&](BasicBlock *BB) { in buildClonedLoopBlocks()
1053 if (auto *ClonedSuccBB = cast_or_null<BasicBlock>(VMap.lookup(SuccBB))) in buildClonedLoopBlocks()
1059 auto *ClonedParentBB = cast<BasicBlock>(VMap.lookup(ParentBB)); in buildClonedLoopBlocks()
1064 auto *ClonedSuccBB = cast_or_null<BasicBlock>(VMap.lookup(SuccBB)); in buildClonedLoopBlocks()
1074 auto *ClonedSuccBB = cast<BasicBlock>(VMap.lookup(UnswitchedSuccBB)); in buildClonedLoopBlocks()
1097 SmallPtrSet<BasicBlock *, 4> SuccSet; in buildClonedLoopBlocks()
1120 auto *ClonedBB = cast<BasicBlock>(VMap.lookup(BB)); in cloneLoopNest()
1173 static void buildClonedLoops(Loop &OrigL, ArrayRef<BasicBlock *> ExitBlocks, in buildClonedLoops()
1181 auto *ClonedPH = cast<BasicBlock>(VMap.lookup(OrigPH)); in buildClonedLoops()
1182 auto *ClonedHeader = cast<BasicBlock>(VMap.lookup(OrigHeader)); in buildClonedLoops()
1189 SmallVector<BasicBlock *, 4> ClonedExitsInLoops; in buildClonedLoops()
1190 SmallDenseMap<BasicBlock *, Loop *, 16> ExitLoopMap; in buildClonedLoops()
1193 if (auto *ClonedExitBB = cast_or_null<BasicBlock>(VMap.lookup(ExitBB))) in buildClonedLoops()
1209 SmallSetVector<BasicBlock *, 16> ClonedLoopBlocks; in buildClonedLoops()
1211 if (auto *ClonedBB = cast_or_null<BasicBlock>(VMap.lookup(BB))) in buildClonedLoops()
1218 SmallVector<BasicBlock *, 16> Worklist; in buildClonedLoops()
1219 SmallPtrSet<BasicBlock *, 16> BlocksInClonedLoop; in buildClonedLoops()
1246 BasicBlock *BB = Worklist.pop_back_val(); in buildClonedLoops()
1277 auto *ClonedBB = cast_or_null<BasicBlock>(VMap.lookup(BB)); in buildClonedLoops()
1300 cast_or_null<BasicBlock>(VMap.lookup(ChildL->getHeader())); in buildClonedLoops()
1309 cast<BasicBlock>(VMap.lookup(ChildLoopBB))) && in buildClonedLoops()
1325 SmallPtrSet<BasicBlock *, 16> UnloopedBlockSet; in buildClonedLoops()
1337 llvm::sort(OrderedClonedExitsInLoops, [&](BasicBlock *LHS, BasicBlock *RHS) { in buildClonedLoops()
1347 BasicBlock *ExitBB = OrderedClonedExitsInLoops.pop_back_val(); in buildClonedLoops()
1354 BasicBlock *BB = Worklist.pop_back_val(); in buildClonedLoops()
1359 for (BasicBlock *PredBB : predecessors(BB)) { in buildClonedLoops()
1388 for (auto *BB : llvm::concat<BasicBlock *const>( in buildClonedLoops()
1407 cast_or_null<BasicBlock>(VMap.lookup(ChildL->getHeader())); in buildClonedLoops()
1423 deleteDeadClonedBlocks(Loop &L, ArrayRef<BasicBlock *> ExitBlocks, in deleteDeadClonedBlocks()
1427 SmallVector<BasicBlock *, 16> DeadBlocks; in deleteDeadClonedBlocks()
1428 for (BasicBlock *BB : llvm::concat<BasicBlock *const>(L.blocks(), ExitBlocks)) in deleteDeadClonedBlocks()
1430 if (BasicBlock *ClonedBB = cast_or_null<BasicBlock>(VMap->lookup(BB))) in deleteDeadClonedBlocks()
1432 for (BasicBlock *SuccBB : successors(ClonedBB)) in deleteDeadClonedBlocks()
1439 SmallPtrSet<BasicBlock *, 16> DeadBlockSet(DeadBlocks.begin(), in deleteDeadClonedBlocks()
1445 for (BasicBlock *BB : DeadBlocks) in deleteDeadClonedBlocks()
1448 for (BasicBlock *BB : DeadBlocks) in deleteDeadClonedBlocks()
1453 SmallVectorImpl<BasicBlock *> &ExitBlocks, in deleteDeadBlocksFromLoop()
1458 SmallPtrSet<BasicBlock *, 16> DeadBlockSet; in deleteDeadBlocksFromLoop()
1462 SmallVector<BasicBlock *, 16> DeathCandidates(ExitBlocks.begin(), in deleteDeadBlocksFromLoop()
1468 for (BasicBlock *SuccBB : successors(BB)) { in deleteDeadBlocksFromLoop()
1483 [&](BasicBlock *BB) { return DeadBlockSet.count(BB); }); in deleteDeadBlocksFromLoop()
1490 [&](BasicBlock *BB) { return DeadBlockSet.count(BB); }); in deleteDeadBlocksFromLoop()
1500 [&](BasicBlock *ChildBB) { in deleteDeadBlocksFromLoop()
1536 static SmallPtrSet<const BasicBlock *, 16> recomputeLoopBlockSet(Loop &L, in recomputeLoopBlockSet()
1538 SmallPtrSet<const BasicBlock *, 16> LoopBlockSet; in recomputeLoopBlockSet()
1544 SmallVector<BasicBlock *, 16> Worklist; in recomputeLoopBlockSet()
1572 BasicBlock *BB = Worklist.pop_back_val(); in recomputeLoopBlockSet()
1647 static bool rebuildLoopAfterUnswitch(Loop &L, ArrayRef<BasicBlock *> ExitBlocks, in rebuildLoopAfterUnswitch()
1656 SmallVector<BasicBlock *, 4> ExitsInLoops; in rebuildLoopAfterUnswitch()
1681 llvm::erase_if(IL->getBlocksVector(), [&](BasicBlock *BB) { in rebuildLoopAfterUnswitch()
1701 [&](BasicBlock *BB) { return LoopBlockSet.count(BB); }); in rebuildLoopAfterUnswitch()
1704 SmallPtrSet<BasicBlock *, 16> UnloopedBlocks(BlocksSplitI, Blocks.end()); in rebuildLoopAfterUnswitch()
1716 [&](BasicBlock *LHS, BasicBlock *RHS) { in rebuildLoopAfterUnswitch()
1721 SmallPtrSet<BasicBlock *, 16> NewExitLoopBlocks; in rebuildLoopAfterUnswitch()
1725 [](Loop &L, SmallPtrSetImpl<BasicBlock *> &UnloopedBlocks) { in rebuildLoopAfterUnswitch()
1728 llvm::erase_if(L.getBlocksVector(), [&](BasicBlock *BB) { in rebuildLoopAfterUnswitch()
1733 SmallVector<BasicBlock *, 16> Worklist; in rebuildLoopAfterUnswitch()
1739 BasicBlock *ExitBB = ExitsInLoops.pop_back_val(); in rebuildLoopAfterUnswitch()
1754 BasicBlock *BB = Worklist.pop_back_val(); in rebuildLoopAfterUnswitch()
1759 for (BasicBlock *PredBB : predecessors(BB)) { in rebuildLoopAfterUnswitch()
1852 void visitDomSubTree(DominatorTree &DT, BasicBlock *BB, CallableT Callable) { in visitDomSubTree()
1877 SmallVectorImpl<BasicBlock *> &ExitBlocks, DominatorTree &DT, LoopInfo &LI, in unswitchNontrivialInvariants()
1918 BasicBlock *RetainedSuccBB = in unswitchNontrivialInvariants()
1920 SmallSetVector<BasicBlock *, 4> UnswitchedSuccBBs; in unswitchNontrivialInvariants()
1974 SmallDenseMap<BasicBlock *, BasicBlock *, 16> DominatingSucc; in unswitchNontrivialInvariants()
1975 for (auto *SuccBB : llvm::concat<BasicBlock *const>( in unswitchNontrivialInvariants()
1978 llvm::all_of(predecessors(SuccBB), [&](BasicBlock *PredBB) { in unswitchNontrivialInvariants()
1981 visitDomSubTree(DT, SuccBB, [&](BasicBlock *BB) { in unswitchNontrivialInvariants()
1991 BasicBlock *SplitBB = L.getLoopPreheader(); in unswitchNontrivialInvariants()
1992 BasicBlock *LoopPH = SplitEdge(SplitBB, L.getHeader(), &DT, &LI, MSSAU); in unswitchNontrivialInvariants()
2000 SmallDenseMap<BasicBlock *, BasicBlock *, 4> ClonedPHs; in unswitchNontrivialInvariants()
2023 BasicBlock *ClonedPH = ClonedPHs.begin()->second; in unswitchNontrivialInvariants()
2043 for (BasicBlock *SuccBB : UnswitchedSuccBBs) in unswitchNontrivialInvariants()
2056 for (BasicBlock *SuccBB : UnswitchedSuccBBs) in unswitchNontrivialInvariants()
2065 for (BasicBlock *SuccBB : UnswitchedSuccBBs) in unswitchNontrivialInvariants()
2076 BasicBlock *UnswitchedSuccBB = *UnswitchedSuccBBs.begin(); in unswitchNontrivialInvariants()
2098 for (BasicBlock *SuccBB : UnswitchedSuccBBs) in unswitchNontrivialInvariants()
2112 BasicBlock *ClonedPH = ClonedPHs.begin()->second; in unswitchNontrivialInvariants()
2171 BasicBlock *ClonedPH = ClonedPHs.begin()->second; in unswitchNontrivialInvariants()
2298 const SmallDenseMap<BasicBlock *, int, 4> &BBCostMap, in computeDomSubtreeCost() argument
2346 SmallVectorImpl<BasicBlock *> &ExitBlocks, in turnGuardIntoBranch()
2350 BasicBlock *CheckBB = GI->getParent(); in turnGuardIntoBranch()
2357 SmallPtrSet<BasicBlock *, 4> Successors; in turnGuardIntoBranch()
2369 BasicBlock *GuardedBlock = CheckBI->getSuccessor(0); in turnGuardIntoBranch()
2372 BasicBlock *DeoptBlock = CheckBI->getSuccessor(1); in turnGuardIntoBranch()
2430 BasicBlock *Latch = L.getLoopLatch(); in calculateUnswitchCostMultiplier()
2431 BasicBlock *CondBlock = TI.getParent(); in calculateUnswitchCostMultiplier()
2434 llvm::count_if(successors(&TI), [&L](BasicBlock *SuccBB) { in calculateUnswitchCostMultiplier()
2449 BasicBlock *CondBlock = CI->getParent(); in calculateUnswitchCostMultiplier()
2457 successors(CondBlock), [SkipExitingSuccessors, &L](BasicBlock *SuccBB) { in calculateUnswitchCostMultiplier()
2569 if (containsIrreducibleCFG<const BasicBlock *>(RPOT, LI)) in unswitchBestCondition()
2572 SmallVector<BasicBlock *, 4> ExitBlocks; in unswitchBestCondition()
2596 SmallDenseMap<BasicBlock *, int, 4> BBCostMap; in unswitchBestCondition()
2643 BasicBlock &BB = *TI.getParent(); in unswitchBestCondition()
2644 SmallPtrSet<BasicBlock *, 4> Visited; in unswitchBestCondition()
2647 for (BasicBlock *SuccBB : successors(&BB)) { in unswitchBestCondition()
2677 llvm::all_of(predecessors(SuccBB), [&](BasicBlock *PredBB) { in unswitchBestCondition()