Lines Matching defs:PredBB
117 // [Block PredBB]
167 auto *PredBB = IncomingBB;
171 BranchInst *PredBr = dyn_cast<BranchInst>(PredBB->getTerminator());
173 return {PredBB, SuccBB};
174 Visited.insert(PredBB);
175 auto *SinglePredBB = PredBB->getSinglePredecessor();
184 SuccBB = PredBB;
185 PredBB = SinglePredBB;
206 BasicBlock *PredBB = PredOutEdge.first;
207 BranchInst *PredBr = dyn_cast<BranchInst>(PredBB->getTerminator());
760 BasicBlock *PredBB = PN->getIncomingBlock(i);
764 RHS = CmpRHS->DoPHITranslation(BB, PredBB);
766 LHS = CmpLHS->DoPHITranslation(BB, PredBB);
779 Res = LVI->getPredicateOnEdge(Pred, LHS, cast<Constant>(RHS), PredBB,
784 Result.emplace_back(KC, PredBB);
1297 for (BasicBlock *PredBB : predecessors(LoadBB)) {
1299 if (!PredsScanned.insert(PredBB).second)
1302 BBIt = PredBB->end();
1313 MemoryLocation Loc(LoadedPtr->DoPHITranslation(LoadBB, PredBB),
1317 Loc, AccessTy, LoadI->isAtomic(), PredBB, BBIt, DefMaxInstsToScan,
1320 // If PredBB has a single predecessor, continue scanning through the
1322 BasicBlock *SinglePredBB = PredBB;
1336 OneUnavailablePred = PredBB;
1345 AvailablePreds.emplace_back(PredBB, PredAvailable);
1502 BasicBlock *PredBB = BB->getSinglePredecessor();
1503 assert(PredBB && "Expected a single predecessor");
1509 // Consult LVI if V is not an instruction in BB or PredBB.
1511 if (!I || (I->getParent() != BB && I->getParent() != PredBB)) {
1512 return LVI->getConstantOnEdge(V, PredPredBB, PredBB, nullptr);
1517 if (PHI->getParent() == PredBB)
1522 // If we have a CmpInst, try to fold it for each incoming edge into PredBB.
1737 BasicBlock *PredBB = PN->getIncomingBlock(i);
1738 if (BranchInst *PredBr = dyn_cast<BranchInst>(PredBB->getTerminator()))
1740 PredBBs[0] = PredBB;
1741 // Try to duplicate BB into PredBB.
1860 // Try to duplicate BB into PredBB.
1999 /// arguments that come from PredBB. Return the map from the variables in the
2006 BasicBlock *PredBB) {
2009 // block, evaluate them to account for entry from PredBB.
2060 NewPN->addIncoming(PN->getIncomingValueForBlock(PredBB), PredBB);
2069 LLVMContext &Context = PredBB->getContext();
2120 // PredBB:
2130 // we take to BB. However, once we duplicate PredBB for each of its incoming
2132 // PredBB. Then we can thread edges PredBB1->BB and PredBB2->BB through BB.
2140 BasicBlock *PredBB = BB->getSinglePredecessor();
2141 if (!PredBB)
2144 // Require that PredBB end with a conditional Branch. If PredBB ends with an
2145 // unconditional branch, we should be merging PredBB and BB instead. For
2147 BranchInst *PredBBBranch = dyn_cast<BranchInst>(PredBB->getTerminator());
2151 // If PredBB has exactly one incoming edge, we don't gain anything by copying
2152 // PredBB.
2153 if (PredBB->getSinglePredecessor())
2156 // Don't thread through PredBB if it contains a successor edge to itself, in
2158 // PredPredBB through PredBB and BB to SuccBB with PredBB containing a
2160 // could duplicate PredBB and BB as, say, PredBB.thread and BB.thread. Since
2161 // PredBB.thread has a successor edge to PredBB, we would immediately come up
2162 // with another jump threading opportunity from PredBB.thread through PredBB
2164 // would keep peeling one iteration from PredBB.
2165 if (llvm::is_contained(successors(PredBB), PredBB))
2169 if (LoopHeaders.count(PredBB))
2173 if (PredBB->isEHPad())
2178 // PredBB.
2184 for (BasicBlock *P : predecessors(PredBB)) {
2235 // Compute the cost of duplicating BB and PredBB.
2239 TTI, PredBB, PredBB->getTerminator(), BBDupThreshold);
2248 << " for PredBB, " << BBCost << "for BB\n");
2252 // Now we are ready to duplicate PredBB.
2253 threadThroughTwoBasicBlocks(PredPredBB, PredBB, BB, SuccBB);
2258 BasicBlock *PredBB,
2261 LLVM_DEBUG(dbgs() << " Threading through '" << PredBB->getName() << "' and '"
2270 BranchInst *PredBBBranch = cast<BranchInst>(PredBB->getTerminator());
2273 BasicBlock::Create(PredBB->getContext(), PredBB->getName() + ".thread",
2274 PredBB->getParent(), PredBB);
2275 NewBB->moveAfter(PredBB);
2281 BPI->getEdgeProbability(PredPredBB, PredBB);
2286 // copy of the block 'NewBB'. If there are PHI nodes in PredBB, evaluate them
2289 cloneInstructions(ValueMapping, PredBB->begin(), PredBB->end(), NewBB,
2292 // Copy the edge probabilities from PredBB to NewBB.
2294 BPI->copyEdgeProbabilities(PredBB, NewBB);
2296 // Update the terminator of PredPredBB to jump to NewBB instead of PredBB.
2298 // any PHI nodes in PredBB.
2301 if (PredPredTerm->getSuccessor(i) == PredBB) {
2302 PredBB->removePredecessor(PredPredBB, true);
2306 addPHINodeEntriesForMappedBlock(PredBBBranch->getSuccessor(0), PredBB, NewBB,
2308 addPHINodeEntriesForMappedBlock(PredBBBranch->getSuccessor(1), PredBB, NewBB,
2315 {DominatorTree::Delete, PredPredBB, PredBB}});
2317 updateSSA(PredBB, NewBB, ValueMapping);
2322 SimplifyInstructionsInBlock(PredBB, TLI);
2383 BasicBlock *PredBB;
2385 PredBB = PredBBs[0];
2389 PredBB = splitBlockPreds(BB, PredBBs, ".thr_comm");
2393 LLVM_DEBUG(dbgs() << " Threading edge from '" << PredBB->getName()
2397 LVI->threadEdge(PredBB, BB, SuccBB);
2402 NewBB->moveAfter(PredBB);
2408 BFI->getBlockFreq(PredBB) * BPI->getEdgeProbability(PredBB, BB);
2415 PredBB);
2426 // Update the terminator of PredBB to jump to NewBB instead of BB. This
2429 Instruction *PredTerm = PredBB->getTerminator();
2432 BB->removePredecessor(PredBB, true);
2438 {DominatorTree::Insert, PredBB, NewBB},
2439 {DominatorTree::Delete, PredBB, BB}});
2449 updateBlockFreqAndEdgeWeight(PredBB, BB, NewBB, SuccBB, BFI, BPI, HasProfile);
2512 /// Freq(PredBB->BB) / Freq(BB->SuccBB).
2513 void JumpThreadingPass::updateBlockFreqAndEdgeWeight(BasicBlock *PredBB,
2529 // As the edge from PredBB to BB is deleted, we have to update the block
2609 /// duplicateCondBranchOnPHIIntoPred - PredBB contains an unconditional branch
2611 /// If we can duplicate the contents of BB up into PredBB do so now, this
2638 BasicBlock *PredBB;
2640 PredBB = PredBBs[0];
2644 PredBB = splitBlockPreds(BB, PredBBs, ".thr_comm");
2646 Updates.push_back({DominatorTree::Delete, PredBB, BB});
2649 // of PredBB.
2651 << "' into end of '" << PredBB->getName()
2655 // Unless PredBB ends with an unconditional branch, split the edge so that we
2656 // can just clone the bits from BB into the end of the new PredBB.
2657 BranchInst *OldPredBranch = dyn_cast<BranchInst>(PredBB->getTerminator());
2660 BasicBlock *OldPredBB = PredBB;
2661 PredBB = SplitEdge(OldPredBB, BB);
2662 Updates.push_back({DominatorTree::Insert, OldPredBB, PredBB});
2663 Updates.push_back({DominatorTree::Insert, PredBB, BB});
2665 OldPredBranch = cast<BranchInst>(PredBB->getTerminator());
2669 // PredBB block. Evaluate PHI nodes in BB.
2674 ValueMapping[PN] = PN->getIncomingValueForBlock(PredBB);
2675 // Clone the non-phi instructions of BB into PredBB, keeping track of the
2679 New->insertInto(PredBB, OldPredBranch->getIterator());
2717 Updates.push_back({DominatorTree::Insert, PredBB, SuccBB});
2722 // add entries to the PHI nodes for branch from PredBB now.
2724 addPHINodeEntriesForMappedBlock(BBBranch->getSuccessor(0), BB, PredBB,
2726 addPHINodeEntriesForMappedBlock(BBBranch->getSuccessor(1), BB, PredBB,
2729 updateSSA(BB, PredBB, ValueMapping);
2731 // PredBB no longer jumps to BB, remove entries in the PHI node for the edge
2733 BB->removePredecessor(PredBB, true);
2735 // Remove the unconditional branch at the end of the PredBB block.
2738 BPI->copyEdgeProbabilities(BB, PredBB);