Lines Matching defs:DestBB
121 bool CanMergeBlocks(const BasicBlock *BB, const BasicBlock *DestBB) const;
298 BasicBlock *DestBB = BI->getSuccessor(0);
299 if (DestBB == BB)
302 if (!CanMergeBlocks(BB, DestBB))
311 /// CanMergeBlocks - Return true if we can merge BB into DestBB if there is a
315 const BasicBlock *DestBB) const {
324 if (User->getParent() != DestBB || !isa<PHINode>(User))
326 // If User is inside DestBB block and it is a PHINode then check
329 if (User->getParent() == DestBB) {
341 // If BB and DestBB contain any common predecessors, then the phi nodes in BB
342 // and DestBB may have conflicting incoming values for the block. If so, we
344 const PHINode *DestBBPN = dyn_cast<PHINode>(DestBB->begin());
357 // Walk the preds of DestBB.
361 BBI = DestBB->begin();
385 BasicBlock *DestBB = BI->getSuccessor(0);
387 DEBUG(dbgs() << "MERGING MOSTLY EMPTY BLOCKS - BEFORE:\n" << *BB << *DestBB);
391 if (BasicBlock *SinglePred = DestBB->getSinglePredecessor()) {
392 if (SinglePred != DestBB) {
396 MergeBasicBlockIntoOnlyPred(DestBB, this);
401 DEBUG(dbgs() << "AFTER:\n" << *DestBB << "\n\n\n");
406 // Otherwise, we have multiple predecessors of BB. Update the PHIs in DestBB
409 for (BasicBlock::iterator BBI = DestBB->begin();
436 // DestBB and remove BB.
437 BB->replaceAllUsesWith(DestBB);
440 BasicBlock *DestBBIDom = DT->getNode(DestBB)->getIDom()->getBlock();
442 DT->changeImmediateDominator(DestBB, NewIDom);
446 PFI->replaceAllUses(BB, DestBB);
447 PFI->removeEdge(ProfileInfo::getEdge(BB, DestBB));
452 DEBUG(dbgs() << "AFTER:\n" << *DestBB << "\n\n\n");