Lines Matching defs:PredBB
119 // [Block PredBB]
169 auto *PredBB = IncomingBB;
173 BranchInst *PredBr = dyn_cast<BranchInst>(PredBB->getTerminator());
175 return {PredBB, SuccBB};
176 Visited.insert(PredBB);
177 auto *SinglePredBB = PredBB->getSinglePredecessor();
186 SuccBB = PredBB;
187 PredBB = SinglePredBB;
208 BasicBlock *PredBB = PredOutEdge.first;
209 BranchInst *PredBr = dyn_cast<BranchInst>(PredBB->getTerminator());
761 BasicBlock *PredBB = PN->getIncomingBlock(i);
765 RHS = CmpRHS->DoPHITranslation(BB, PredBB);
767 LHS = CmpLHS->DoPHITranslation(BB, PredBB);
780 Res = LVI->getPredicateOnEdge(Pred, LHS, cast<Constant>(RHS), PredBB,
785 Result.emplace_back(KC, PredBB);
1298 for (BasicBlock *PredBB : predecessors(LoadBB)) {
1300 if (!PredsScanned.insert(PredBB).second)
1303 BBIt = PredBB->end();
1314 MemoryLocation Loc(LoadedPtr->DoPHITranslation(LoadBB, PredBB),
1318 Loc, AccessTy, LoadI->isAtomic(), PredBB, BBIt, DefMaxInstsToScan,
1321 // If PredBB has a single predecessor, continue scanning through the
1323 BasicBlock *SinglePredBB = PredBB;
1337 OneUnavailablePred = PredBB;
1346 AvailablePreds.emplace_back(PredBB, PredAvailable);
1503 BasicBlock *PredBB = BB->getSinglePredecessor();
1504 assert(PredBB && "Expected a single predecessor");
1510 // Consult LVI if V is not an instruction in BB or PredBB.
1512 if (!I || (I->getParent() != BB && I->getParent() != PredBB)) {
1513 return LVI->getConstantOnEdge(V, PredPredBB, PredBB, nullptr);
1518 if (PHI->getParent() == PredBB)
1523 // If we have a CmpInst, try to fold it for each incoming edge into PredBB.
1738 BasicBlock *PredBB = PN->getIncomingBlock(i);
1739 if (BranchInst *PredBr = dyn_cast<BranchInst>(PredBB->getTerminator()))
1741 PredBBs[0] = PredBB;
1742 // Try to duplicate BB into PredBB.
1861 // Try to duplicate BB into PredBB.
2000 /// arguments that come from PredBB. Return the map from the variables in the
2007 BasicBlock *PredBB) {
2010 // block, evaluate them to account for entry from PredBB.
2061 NewPN->addIncoming(PN->getIncomingValueForBlock(PredBB), PredBB);
2070 LLVMContext &Context = PredBB->getContext();
2123 // PredBB:
2133 // we take to BB. However, once we duplicate PredBB for each of its incoming
2135 // PredBB. Then we can thread edges PredBB1->BB and PredBB2->BB through BB.
2143 BasicBlock *PredBB = BB->getSinglePredecessor();
2144 if (!PredBB)
2147 // Require that PredBB end with a conditional Branch. If PredBB ends with an
2148 // unconditional branch, we should be merging PredBB and BB instead. For
2150 BranchInst *PredBBBranch = dyn_cast<BranchInst>(PredBB->getTerminator());
2154 // If PredBB has exactly one incoming edge, we don't gain anything by copying
2155 // PredBB.
2156 if (PredBB->getSinglePredecessor())
2159 // Don't thread through PredBB if it contains a successor edge to itself, in
2161 // PredPredBB through PredBB and BB to SuccBB with PredBB containing a
2163 // could duplicate PredBB and BB as, say, PredBB.thread and BB.thread. Since
2164 // PredBB.thread has a successor edge to PredBB, we would immediately come up
2165 // with another jump threading opportunity from PredBB.thread through PredBB
2167 // would keep peeling one iteration from PredBB.
2168 if (llvm::is_contained(successors(PredBB), PredBB))
2172 if (LoopHeaders.count(PredBB))
2176 if (PredBB->isEHPad())
2181 // PredBB.
2187 for (BasicBlock *P : predecessors(PredBB)) {
2238 // Compute the cost of duplicating BB and PredBB.
2242 TTI, PredBB, PredBB->getTerminator(), BBDupThreshold);
2251 << " for PredBB, " << BBCost << "for BB\n");
2255 // Now we are ready to duplicate PredBB.
2256 threadThroughTwoBasicBlocks(PredPredBB, PredBB, BB, SuccBB);
2261 BasicBlock *PredBB,
2264 LLVM_DEBUG(dbgs() << " Threading through '" << PredBB->getName() << "' and '"
2273 BranchInst *PredBBBranch = cast<BranchInst>(PredBB->getTerminator());
2276 BasicBlock::Create(PredBB->getContext(), PredBB->getName() + ".thread",
2277 PredBB->getParent(), PredBB);
2278 NewBB->moveAfter(PredBB);
2284 BPI->getEdgeProbability(PredPredBB, PredBB);
2289 // copy of the block 'NewBB'. If there are PHI nodes in PredBB, evaluate them
2292 cloneInstructions(ValueMapping, PredBB->begin(), PredBB->end(), NewBB,
2295 // Copy the edge probabilities from PredBB to NewBB.
2297 BPI->copyEdgeProbabilities(PredBB, NewBB);
2299 // Update the terminator of PredPredBB to jump to NewBB instead of PredBB.
2301 // any PHI nodes in PredBB.
2304 if (PredPredTerm->getSuccessor(i) == PredBB) {
2305 PredBB->removePredecessor(PredPredBB, true);
2309 addPHINodeEntriesForMappedBlock(PredBBBranch->getSuccessor(0), PredBB, NewBB,
2311 addPHINodeEntriesForMappedBlock(PredBBBranch->getSuccessor(1), PredBB, NewBB,
2318 {DominatorTree::Delete, PredPredBB, PredBB}});
2320 updateSSA(PredBB, NewBB, ValueMapping);
2325 SimplifyInstructionsInBlock(PredBB, TLI);
2386 BasicBlock *PredBB;
2388 PredBB = PredBBs[0];
2392 PredBB = splitBlockPreds(BB, PredBBs, ".thr_comm");
2396 LLVM_DEBUG(dbgs() << " Threading edge from '" << PredBB->getName()
2400 LVI->threadEdge(PredBB, BB, SuccBB);
2405 NewBB->moveAfter(PredBB);
2411 BFI->getBlockFreq(PredBB) * BPI->getEdgeProbability(PredBB, BB);
2418 PredBB);
2429 // Update the terminator of PredBB to jump to NewBB instead of BB. This
2432 Instruction *PredTerm = PredBB->getTerminator();
2435 BB->removePredecessor(PredBB, true);
2441 {DominatorTree::Insert, PredBB, NewBB},
2442 {DominatorTree::Delete, PredBB, BB}});
2452 updateBlockFreqAndEdgeWeight(PredBB, BB, NewBB, SuccBB, BFI, BPI, HasProfile);
2515 /// Freq(PredBB->BB) / Freq(BB->SuccBB).
2516 void JumpThreadingPass::updateBlockFreqAndEdgeWeight(BasicBlock *PredBB,
2532 // As the edge from PredBB to BB is deleted, we have to update the block
2612 /// duplicateCondBranchOnPHIIntoPred - PredBB contains an unconditional branch
2614 /// If we can duplicate the contents of BB up into PredBB do so now, this
2641 BasicBlock *PredBB;
2643 PredBB = PredBBs[0];
2647 PredBB = splitBlockPreds(BB, PredBBs, ".thr_comm");
2649 Updates.push_back({DominatorTree::Delete, PredBB, BB});
2652 // of PredBB.
2654 << "' into end of '" << PredBB->getName()
2658 // Unless PredBB ends with an unconditional branch, split the edge so that we
2659 // can just clone the bits from BB into the end of the new PredBB.
2660 BranchInst *OldPredBranch = dyn_cast<BranchInst>(PredBB->getTerminator());
2663 BasicBlock *OldPredBB = PredBB;
2664 PredBB = SplitEdge(OldPredBB, BB);
2665 Updates.push_back({DominatorTree::Insert, OldPredBB, PredBB});
2666 Updates.push_back({DominatorTree::Insert, PredBB, BB});
2668 OldPredBranch = cast<BranchInst>(PredBB->getTerminator());
2672 // PredBB block. Evaluate PHI nodes in BB.
2677 ValueMapping[PN] = PN->getIncomingValueForBlock(PredBB);
2678 // Clone the non-phi instructions of BB into PredBB, keeping track of the
2682 New->insertInto(PredBB, OldPredBranch->getIterator());
2720 Updates.push_back({DominatorTree::Insert, PredBB, SuccBB});
2725 // add entries to the PHI nodes for branch from PredBB now.
2727 addPHINodeEntriesForMappedBlock(BBBranch->getSuccessor(0), BB, PredBB,
2729 addPHINodeEntriesForMappedBlock(BBBranch->getSuccessor(1), BB, PredBB,
2732 updateSSA(BB, PredBB, ValueMapping);
2734 // PredBB no longer jumps to BB, remove entries in the PHI node for the edge
2736 BB->removePredecessor(PredBB, true);
2738 // Remove the unconditional branch at the end of the PredBB block.
2741 BPI->copyEdgeProbabilities(BB, PredBB);