Lines Matching refs:BB
36 void llvm::DeleteDeadBlock(BasicBlock *BB) { in DeleteDeadBlock() argument
37 assert((pred_begin(BB) == pred_end(BB) || in DeleteDeadBlock()
39 BB->getSinglePredecessor() == BB) && "Block is not dead!"); in DeleteDeadBlock()
40 TerminatorInst *BBTerm = BB->getTerminator(); in DeleteDeadBlock()
45 Succ->removePredecessor(BB); in DeleteDeadBlock()
48 while (!BB->empty()) { in DeleteDeadBlock()
49 Instruction &I = BB->back(); in DeleteDeadBlock()
57 BB->getInstList().pop_back(); in DeleteDeadBlock()
61 BB->eraseFromParent(); in DeleteDeadBlock()
68 void llvm::FoldSingleEntryPHINodes(BasicBlock *BB, in FoldSingleEntryPHINodes() argument
70 if (!isa<PHINode>(BB->begin())) return; in FoldSingleEntryPHINodes()
72 while (PHINode *PN = dyn_cast<PHINode>(BB->begin())) { in FoldSingleEntryPHINodes()
90 bool llvm::DeleteDeadPHIs(BasicBlock *BB, const TargetLibraryInfo *TLI) { in DeleteDeadPHIs() argument
94 for (BasicBlock::iterator I = BB->begin(); in DeleteDeadPHIs()
108 bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DominatorTree *DT, in MergeBlockIntoPredecessor() argument
112 if (BB->hasAddressTaken()) return false; in MergeBlockIntoPredecessor()
115 BasicBlock *PredBB = BB->getUniquePredecessor(); in MergeBlockIntoPredecessor()
119 if (PredBB == BB) return false; in MergeBlockIntoPredecessor()
125 BasicBlock *OnlySucc = BB; in MergeBlockIntoPredecessor()
136 for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE; ++BI) { in MergeBlockIntoPredecessor()
146 if (isa<PHINode>(BB->front())) in MergeBlockIntoPredecessor()
147 FoldSingleEntryPHINodes(BB, MemDep); in MergeBlockIntoPredecessor()
154 BB->replaceAllUsesWith(PredBB); in MergeBlockIntoPredecessor()
157 PredBB->getInstList().splice(PredBB->end(), BB->getInstList()); in MergeBlockIntoPredecessor()
161 PredBB->takeName(BB); in MergeBlockIntoPredecessor()
165 if (DomTreeNode *DTN = DT->getNode(BB)) { in MergeBlockIntoPredecessor()
173 DT->eraseNode(BB); in MergeBlockIntoPredecessor()
177 LI->removeBlock(BB); in MergeBlockIntoPredecessor()
182 BB->eraseFromParent(); in MergeBlockIntoPredecessor()
238 BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock *Succ, DominatorTree *DT, in SplitEdge() argument
240 unsigned SuccNum = GetSuccessorNumber(BB, Succ); in SplitEdge()
243 TerminatorInst *LatchTerm = BB->getTerminator(); in SplitEdge()
253 assert(SP == BB && "CFG broken"); in SplitEdge()
260 assert(BB->getTerminator()->getNumSuccessors() == 1 && in SplitEdge()
262 return SplitBlock(BB, BB->getTerminator(), DT, LI); in SplitEdge()
474 BasicBlock *llvm::SplitBlockPredecessors(BasicBlock *BB, in SplitBlockPredecessors() argument
479 if (!BB->canSplitPredecessors()) in SplitBlockPredecessors()
484 if (BB->isLandingPad()) { in SplitBlockPredecessors()
488 SplitLandingPadPredecessors(BB, Preds, Suffix, NewName.c_str(), NewBBs, DT, in SplitBlockPredecessors()
495 BB->getContext(), BB->getName() + Suffix, BB->getParent(), BB); in SplitBlockPredecessors()
498 BranchInst *BI = BranchInst::Create(BB, NewBB); in SplitBlockPredecessors()
499 BI->setDebugLoc(BB->getFirstNonPHI()->getDebugLoc()); in SplitBlockPredecessors()
508 Preds[i]->getTerminator()->replaceUsesOfWith(BB, NewBB); in SplitBlockPredecessors()
517 for (BasicBlock::iterator I = BB->begin(); isa<PHINode>(I); ++I) in SplitBlockPredecessors()
524 UpdateAnalysisInformation(BB, NewBB, Preds, DT, LI, PreserveLCSSA, in SplitBlockPredecessors()
528 UpdatePHINodes(BB, NewBB, Preds, BI, HasLoopExit); in SplitBlockPredecessors()
648 ReturnInst *llvm::FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB, in FoldReturnIntoUncondBranch() argument
670 if (PN->getParent() == BB) { in FoldReturnIntoUncondBranch()
681 BB->removePredecessor(Pred); in FoldReturnIntoUncondBranch()
787 Value *llvm::GetIfCondition(BasicBlock *BB, BasicBlock *&IfTrue, in GetIfCondition() argument
789 PHINode *SomePHI = dyn_cast<PHINode>(BB->begin()); in GetIfCondition()
799 pred_iterator PI = pred_begin(BB), PE = pred_end(BB); in GetIfCondition()
840 if (Pred1Br->getSuccessor(0) == BB && in GetIfCondition()
845 Pred1Br->getSuccessor(1) == BB) { in GetIfCondition()