Lines Matching refs:FC1

634                                const FusionCandidate &FC1) const {  in isControlFlowEquivalent()
635 assert(FC0.Preheader && FC1.Preheader && "Expecting valid preheaders"); in isControlFlowEquivalent()
637 return ::isControlFlowEquivalent(*FC0.getEntryBlock(), *FC1.getEntryBlock(), in isControlFlowEquivalent()
691 const FusionCandidate &FC1) { in isBeneficialFusion()
705 const FusionCandidate &FC1) const { in haveIdenticalTripCounts()
714 const SCEV *TripCount1 = SE.getBackedgeTakenCount(FC1.L); in haveIdenticalTripCounts()
735 const unsigned TC1 = SE.getSmallConstantTripCount(FC1.L); in haveIdenticalTripCounts()
763 void peelFusionCandidate(FusionCandidate &FC0, const FusionCandidate &FC1, in peelFusionCandidate()
775 auto IdenticalTripCount = haveIdenticalTripCounts(FC0, FC1); in peelFusionCandidate()
797 FC0.GuardBranch ? FC0.ExitBlock->getUniqueSuccessor() : FC1.Preheader; in peelFusionCandidate()
847 auto FC1 = FC0; in fuseCandidates() local
848 for (++FC1; FC1 != CandidateSet.end(); ++FC1) { in fuseCandidates()
849 assert(!LDT.isRemovedLoop(FC1->L) && in fuseCandidates()
853 dbgs() << " with\n"; FC1->dump(); dbgs() << "\n"); in fuseCandidates()
856 FC1->verify(); in fuseCandidates()
864 haveIdenticalTripCounts(*FC0, *FC1); in fuseCandidates()
886 reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1, in fuseCandidates()
891 if (!isAdjacent(*FC0, *FC1)) { in fuseCandidates()
894 reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1, NonAdjacent); in fuseCandidates()
898 if (!FC0->GuardBranch && FC1->GuardBranch) { in fuseCandidates()
902 *FC0, *FC1, OnlySecondCandidateIsGuarded); in fuseCandidates()
908 if (FC0->GuardBranch && FC1->GuardBranch && in fuseCandidates()
909 !haveIdenticalGuards(*FC0, *FC1) && !TCDifference) { in fuseCandidates()
912 reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1, in fuseCandidates()
917 if (!isSafeToMoveBefore(*FC1->Preheader, in fuseCandidates()
922 reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1, in fuseCandidates()
928 assert(FC1->GuardBranch && "Expecting valid FC1 guard branch"); in fuseCandidates()
931 *FC1->ExitBlock->getFirstNonPHIOrDbg(), DT, in fuseCandidates()
935 reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1, in fuseCandidates()
941 *FC1->GuardBranch->getParent(), in fuseCandidates()
947 reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1, in fuseCandidates()
955 if (!dependencesAllowFusion(*FC0, *FC1)) { in fuseCandidates()
957 reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1, in fuseCandidates()
962 bool BeneficialToFuse = isBeneficialFusion(*FC0, *FC1); in fuseCandidates()
967 reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1, in fuseCandidates()
976 << *FC1 << "\n"); in fuseCandidates()
983 peelFusionCandidate(FC0Copy, *FC1, *TCDifference); in fuseCandidates()
989 reportLoopFusion<OptimizationRemark>((Peel ? FC0Copy : *FC0), *FC1, in fuseCandidates()
993 performFusion((Peel ? FC0Copy : *FC0), *FC1), DT, &PDT, ORE, in fuseCandidates()
1000 LDT.removeLoop(FC1->L); in fuseCandidates()
1003 CandidateSet.erase(FC1); in fuseCandidates()
1013 FC0 = FC1 = InsertPos.first; in fuseCandidates()
1119 const FusionCandidate &FC1, Instruction &I0, in dependencesAllowFusion()
1130 return accessDiffIsPositive(*FC0.L, *FC1.L, I0, I1, AnyDep); in dependencesAllowFusion()
1155 return dependencesAllowFusion(FC0, FC1, I0, I1, AnyDep, in dependencesAllowFusion()
1157 dependencesAllowFusion(FC0, FC1, I0, I1, AnyDep, in dependencesAllowFusion()
1166 const FusionCandidate &FC1) { in dependencesAllowFusion()
1167 LLVM_DEBUG(dbgs() << "Check if " << FC0 << " can be fused with " << FC1 in dependencesAllowFusion()
1169 assert(FC0.L->getLoopDepth() == FC1.L->getLoopDepth()); in dependencesAllowFusion()
1170 assert(DT.dominates(FC0.getEntryBlock(), FC1.getEntryBlock())); in dependencesAllowFusion()
1173 for (Instruction *WriteL1 : FC1.MemWrites) in dependencesAllowFusion()
1174 if (!dependencesAllowFusion(FC0, FC1, *WriteL0, *WriteL1, in dependencesAllowFusion()
1180 for (Instruction *ReadL1 : FC1.MemReads) in dependencesAllowFusion()
1181 if (!dependencesAllowFusion(FC0, FC1, *WriteL0, *ReadL1, in dependencesAllowFusion()
1189 for (Instruction *WriteL1 : FC1.MemWrites) { in dependencesAllowFusion()
1191 if (!dependencesAllowFusion(FC0, FC1, *WriteL0, *WriteL1, in dependencesAllowFusion()
1198 if (!dependencesAllowFusion(FC0, FC1, *ReadL0, *WriteL1, in dependencesAllowFusion()
1208 for (BasicBlock *BB : FC1.L->blocks()) in dependencesAllowFusion()
1230 const FusionCandidate &FC1) const { in isAdjacent()
1233 return FC0.getNonLoopBlock() == FC1.getEntryBlock(); in isAdjacent()
1235 return FC0.ExitBlock == FC1.getEntryBlock(); in isAdjacent()
1251 const FusionCandidate &FC1) const { in haveIdenticalGuards()
1252 assert(FC0.GuardBranch && FC1.GuardBranch && in haveIdenticalGuards()
1258 dyn_cast<Instruction>(FC1.GuardBranch->getCondition())) in haveIdenticalGuards()
1266 return (FC1.GuardBranch->getSuccessor(0) == FC1.Preheader); in haveIdenticalGuards()
1268 return (FC1.GuardBranch->getSuccessor(1) == FC1.Preheader); in haveIdenticalGuards()
1287 void mergeLatch(const FusionCandidate &FC0, const FusionCandidate &FC1) { in mergeLatch()
1288 moveInstructionsToTheBeginning(*FC0.Latch, *FC1.Latch, DT, PDT, DI); in mergeLatch()
1324 Loop *performFusion(const FusionCandidate &FC0, const FusionCandidate &FC1) { in performFusion()
1325 assert(FC0.isValid() && FC1.isValid() && in performFusion()
1329 dbgs() << "Fusion Candidate 1: \n"; FC1.dump();); in performFusion()
1333 moveInstructionsToTheEnd(*FC1.Preheader, *FC0.Preheader, DT, PDT, DI); in performFusion()
1339 return fuseGuardedLoops(FC0, FC1); in performFusion()
1341 assert(FC1.Preheader == in performFusion()
1343 assert(FC1.Preheader->size() == 1 && in performFusion()
1344 FC1.Preheader->getSingleSuccessor() == FC1.Header); in performFusion()
1361 FC1.Preheader->replaceSuccessorsPhiUsesWith(FC0.Preheader); in performFusion()
1362 FC0.Latch->replaceSuccessorsPhiUsesWith(FC1.Latch); in performFusion()
1385 FC0.ExitingBlock->getTerminator()->replaceUsesOfWith(FC1.Preheader, in performFusion()
1386 FC1.Header); in performFusion()
1388 DominatorTree::Delete, FC0.ExitingBlock, FC1.Preheader)); in performFusion()
1390 DominatorTree::Insert, FC0.ExitingBlock, FC1.Header)); in performFusion()
1393 DominatorTree::Delete, FC0.ExitBlock, FC1.Preheader)); in performFusion()
1397 FC1.Header); in performFusion()
1402 DominatorTree::Insert, FC0.ExitingBlock, FC1.Header)); in performFusion()
1407 assert(pred_empty(FC1.Preheader)); in performFusion()
1408 FC1.Preheader->getTerminator()->eraseFromParent(); in performFusion()
1409 new UnreachableInst(FC1.Preheader->getContext(), FC1.Preheader); in performFusion()
1411 DominatorTree::Delete, FC1.Preheader, FC1.Header)); in performFusion()
1414 while (PHINode *PHI = dyn_cast<PHINode>(&FC1.Header->front())) { in performFusion()
1427 Instruction *L1HeaderIP = &FC1.Header->front(); in performFusion()
1429 int L1LatchBBIdx = LCPHI->getBasicBlockIndex(FC1.Latch); in performFusion()
1445 FC0.Latch->getTerminator()->replaceUsesOfWith(FC0.Header, FC1.Header); in performFusion()
1446 FC1.Latch->getTerminator()->replaceUsesOfWith(FC1.Header, FC0.Header); in performFusion()
1456 DominatorTree::Insert, FC0.Latch, FC1.Header)); in performFusion()
1461 FC1.Latch, FC0.Header)); in performFusion()
1463 FC1.Latch, FC1.Header)); in performFusion()
1468 LI.removeBlock(FC1.Preheader); in performFusion()
1469 DTU.deleteBB(FC1.Preheader); in performFusion()
1481 SE.forgetLoop(FC1.L); in performFusion()
1486 mergeLatch(FC0, FC1); in performFusion()
1489 SmallVector<BasicBlock *, 8> Blocks(FC1.L->blocks()); in performFusion()
1492 FC1.L->removeBlockFromLoop(BB); in performFusion()
1493 if (LI.getLoopFor(BB) != FC1.L) in performFusion()
1497 while (!FC1.L->isInnermost()) { in performFusion()
1498 const auto &ChildLoopIt = FC1.L->begin(); in performFusion()
1500 FC1.L->removeChildLoop(ChildLoopIt); in performFusion()
1505 LI.erase(FC1.L); in performFusion()
1533 void reportLoopFusion(const FusionCandidate &FC0, const FusionCandidate &FC1, in reportLoopFusion()
1535 assert(FC0.Preheader && FC1.Preheader && in reportLoopFusion()
1544 << " and " << NV("Cand2", StringRef(FC1.Preheader->getName())) in reportLoopFusion()
1565 const FusionCandidate &FC1) { in fuseGuardedLoops()
1566 assert(FC0.GuardBranch && FC1.GuardBranch && "Expecting guarded loops"); in fuseGuardedLoops()
1569 BasicBlock *FC1GuardBlock = FC1.GuardBranch->getParent(); in fuseGuardedLoops()
1571 BasicBlock *FC1NonLoopBlock = FC1.getNonLoopBlock(); in fuseGuardedLoops()
1579 (FC0.Peeled ? *FC0ExitBlockSuccessor : *FC0.ExitBlock), *FC1.ExitBlock, in fuseGuardedLoops()
1602 BBToUpdate->getTerminator()->replaceUsesOfWith(FC1GuardBlock, FC1.Header); in fuseGuardedLoops()
1605 FC1.GuardBranch->eraseFromParent(); in fuseGuardedLoops()
1609 DominatorTree::Delete, FC1GuardBlock, FC1.Preheader)); in fuseGuardedLoops()
1651 FC1.Preheader->replaceSuccessorsPhiUsesWith(FC0.Preheader); in fuseGuardedLoops()
1652 FC0.Latch->replaceSuccessorsPhiUsesWith(FC1.Latch); in fuseGuardedLoops()
1668 FC1.Header); in fuseGuardedLoops()
1673 DominatorTree::Insert, FC0.ExitingBlock, FC1.Header)); in fuseGuardedLoops()
1688 assert(pred_empty(FC1.Preheader)); in fuseGuardedLoops()
1689 FC1.Preheader->getTerminator()->eraseFromParent(); in fuseGuardedLoops()
1690 new UnreachableInst(FC1.Preheader->getContext(), FC1.Preheader); in fuseGuardedLoops()
1692 DominatorTree::Delete, FC1.Preheader, FC1.Header)); in fuseGuardedLoops()
1695 while (PHINode *PHI = dyn_cast<PHINode>(&FC1.Header->front())) { in fuseGuardedLoops()
1708 Instruction *L1HeaderIP = &FC1.Header->front(); in fuseGuardedLoops()
1710 int L1LatchBBIdx = LCPHI->getBasicBlockIndex(FC1.Latch); in fuseGuardedLoops()
1728 FC0.Latch->getTerminator()->replaceUsesOfWith(FC0.Header, FC1.Header); in fuseGuardedLoops()
1729 FC1.Latch->getTerminator()->replaceUsesOfWith(FC1.Header, FC0.Header); in fuseGuardedLoops()
1739 DominatorTree::Insert, FC0.Latch, FC1.Header)); in fuseGuardedLoops()
1744 FC1.Latch, FC0.Header)); in fuseGuardedLoops()
1746 FC1.Latch, FC1.Header)); in fuseGuardedLoops()
1758 LI.removeBlock(FC1.Preheader); in fuseGuardedLoops()
1765 DTU.deleteBB(FC1.Preheader); in fuseGuardedLoops()
1773 SE.forgetLoop(FC1.L); in fuseGuardedLoops()
1778 mergeLatch(FC0, FC1); in fuseGuardedLoops()
1781 SmallVector<BasicBlock *, 8> Blocks(FC1.L->blocks()); in fuseGuardedLoops()
1784 FC1.L->removeBlockFromLoop(BB); in fuseGuardedLoops()
1785 if (LI.getLoopFor(BB) != FC1.L) in fuseGuardedLoops()
1789 while (!FC1.L->isInnermost()) { in fuseGuardedLoops()
1790 const auto &ChildLoopIt = FC1.L->begin(); in fuseGuardedLoops()
1792 FC1.L->removeChildLoop(ChildLoopIt); in fuseGuardedLoops()
1797 LI.erase(FC1.L); in fuseGuardedLoops()