• Home
  • Raw
  • Download

Lines Matching refs:BB

65 bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions,  in ConstantFoldTerminator()  argument
67 TerminatorInst *T = BB->getTerminator(); in ConstantFoldTerminator()
88 OldDest->removePredecessor(BB); in ConstantFoldTerminator()
162 MDBuilder(BB->getContext()). in ConstantFoldTerminator()
189 BasicBlock *BB = SI->getParent(); in ConstantFoldTerminator() local
197 Succ->removePredecessor(BB); in ConstantFoldTerminator()
228 MDBuilder(BB->getContext()). in ConstantFoldTerminator()
268 BB->getTerminator()->eraseFromParent(); in ConstantFoldTerminator()
269 new UnreachableInst(BB->getContext(), BB); in ConstantFoldTerminator()
471 bool llvm::SimplifyInstructionsInBlock(BasicBlock *BB, in SimplifyInstructionsInBlock() argument
474 const DataLayout &DL = BB->getModule()->getDataLayout(); in SimplifyInstructionsInBlock()
481 AssertingVH<Instruction> TerminatorVH(&BB->back()); in SimplifyInstructionsInBlock()
488 for (BasicBlock::iterator BI = BB->begin(), E = std::prev(BB->end()); BI != E;) { in SimplifyInstructionsInBlock()
522 void llvm::RemovePredecessorAndSimplify(BasicBlock *BB, BasicBlock *Pred) { in RemovePredecessorAndSimplify() argument
524 if (!isa<PHINode>(BB->begin())) in RemovePredecessorAndSimplify()
530 BB->removePredecessor(Pred, true); in RemovePredecessorAndSimplify()
532 WeakVH PhiIt = &BB->front(); in RemovePredecessorAndSimplify()
543 if (PhiIt != OldPhiIt) PhiIt = &BB->front(); in RemovePredecessorAndSimplify()
610 static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { in CanPropagatePredecessorsForPHIs() argument
611 assert(*succ_begin(BB) == Succ && "Succ is not successor of BB!"); in CanPropagatePredecessorsForPHIs()
613 DEBUG(dbgs() << "Looking to fold " << BB->getName() << " into " in CanPropagatePredecessorsForPHIs()
620 SmallPtrSet<BasicBlock*, 16> BBPreds(pred_begin(BB), pred_end(BB)); in CanPropagatePredecessorsForPHIs()
630 PHINode *BBPN = dyn_cast<PHINode>(PN->getIncomingValueForBlock(BB)); in CanPropagatePredecessorsForPHIs()
631 if (BBPN && BBPN->getParent() == BB) { in CanPropagatePredecessorsForPHIs()
645 Value* Val = PN->getIncomingValueForBlock(BB); in CanPropagatePredecessorsForPHIs()
680 static Value *selectIncomingValueForBlock(Value *OldVal, BasicBlock *BB, in selectIncomingValueForBlock() argument
683 assert((!IncomingValues.count(BB) || in selectIncomingValueForBlock()
684 IncomingValues.find(BB)->second == OldVal) && in selectIncomingValueForBlock()
687 IncomingValues.insert(std::make_pair(BB, OldVal)); in selectIncomingValueForBlock()
691 IncomingValueMap::const_iterator It = IncomingValues.find(BB); in selectIncomingValueForBlock()
708 BasicBlock *BB = PN->getIncomingBlock(i); in gatherIncomingValuesToPhi() local
712 IncomingValues.insert(std::make_pair(BB, V)); in gatherIncomingValuesToPhi()
728 BasicBlock *BB = PN->getIncomingBlock(i); in replaceUndefValuesInPhi() local
729 IncomingValueMap::const_iterator It = IncomingValues.find(BB); in replaceUndefValuesInPhi()
743 static void redirectValuesFromPredecessorsToPhi(BasicBlock *BB, in redirectValuesFromPredecessorsToPhi() argument
746 Value *OldVal = PN->removeIncomingValue(BB, false); in redirectValuesFromPredecessorsToPhi()
764 if (isa<PHINode>(OldVal) && cast<PHINode>(OldVal)->getParent() == BB) { in redirectValuesFromPredecessorsToPhi()
803 bool llvm::TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB) { in TryToSimplifyUncondBranchFromEmptyBlock() argument
804 assert(BB != &BB->getParent()->getEntryBlock() && in TryToSimplifyUncondBranchFromEmptyBlock()
808 BasicBlock *Succ = cast<BranchInst>(BB->getTerminator())->getSuccessor(0); in TryToSimplifyUncondBranchFromEmptyBlock()
809 if (BB == Succ) return false; in TryToSimplifyUncondBranchFromEmptyBlock()
813 if (!CanPropagatePredecessorsForPHIs(BB, Succ)) return false; in TryToSimplifyUncondBranchFromEmptyBlock()
828 BasicBlock::iterator BBI = BB->begin(); in TryToSimplifyUncondBranchFromEmptyBlock()
832 if (PN->getIncomingBlock(U) != BB) in TryToSimplifyUncondBranchFromEmptyBlock()
842 DEBUG(dbgs() << "Killing Trivial BB: \n" << *BB); in TryToSimplifyUncondBranchFromEmptyBlock()
848 const PredBlockVector BBPreds(pred_begin(BB), pred_end(BB)); in TryToSimplifyUncondBranchFromEmptyBlock()
854 redirectValuesFromPredecessorsToPhi(BB, BBPreds, PN); in TryToSimplifyUncondBranchFromEmptyBlock()
863 BB->getTerminator()->eraseFromParent(); in TryToSimplifyUncondBranchFromEmptyBlock()
865 BB->getInstList()); in TryToSimplifyUncondBranchFromEmptyBlock()
867 while (PHINode *PN = dyn_cast<PHINode>(&BB->front())) { in TryToSimplifyUncondBranchFromEmptyBlock()
875 BB->replaceAllUsesWith(Succ); in TryToSimplifyUncondBranchFromEmptyBlock()
876 if (!Succ->hasName()) Succ->takeName(BB); in TryToSimplifyUncondBranchFromEmptyBlock()
877 BB->eraseFromParent(); // Delete the old basic block. in TryToSimplifyUncondBranchFromEmptyBlock()
886 bool llvm::EliminateDuplicatePHINodes(BasicBlock *BB) { in EliminateDuplicatePHINodes() argument
919 for (auto I = BB->begin(); PHINode *PN = dyn_cast<PHINode>(I++);) { in EliminateDuplicatePHINodes()
930 I = BB->begin(); in EliminateDuplicatePHINodes()
1193 BasicBlock *BB = I->getParent(); in changeToUnreachable() local
1196 for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI) in changeToUnreachable()
1197 (*SI)->removePredecessor(BB); in changeToUnreachable()
1203 Intrinsic::getDeclaration(BB->getParent()->getParent(), Intrinsic::trap); in changeToUnreachable()
1210 BasicBlock::iterator BBI = I->getIterator(), BBE = BB->end(); in changeToUnreachable()
1214 BB->getInstList().erase(BBI++); in changeToUnreachable()
1243 BasicBlock *BB = &F.front(); in markAliveBlocks() local
1244 Worklist.push_back(BB); in markAliveBlocks()
1245 Reachable.insert(BB); in markAliveBlocks()
1248 BB = Worklist.pop_back_val(); in markAliveBlocks()
1253 for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E;++BBI){ in markAliveBlocks()
1309 if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) { in markAliveBlocks()
1326 Changed |= ConstantFoldTerminator(BB, true); in markAliveBlocks()
1327 for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI) in markAliveBlocks()
1334 void llvm::removeUnwindEdge(BasicBlock *BB) { in removeUnwindEdge() argument
1335 TerminatorInst *TI = BB->getTerminator(); in removeUnwindEdge()
1363 UnwindDest->removePredecessor(BB); in removeUnwindEdge()
1384 for (Function::iterator BB = ++F.begin(), E = F.end(); BB != E; ++BB) { in removeUnreachableBlocks() local
1385 if (Reachable.count(&*BB)) in removeUnreachableBlocks()
1388 for (succ_iterator SI = succ_begin(&*BB), SE = succ_end(&*BB); SI != SE; in removeUnreachableBlocks()
1391 (*SI)->removePredecessor(&*BB); in removeUnreachableBlocks()
1392 BB->dropAllReferences(); in removeUnreachableBlocks()
1490 const BasicBlock *BB) { in replaceDominatedUsesWith() argument
1498 if (DT.dominates(BB, I->getParent())) { in replaceDominatedUsesWith()