Home | History | Annotate | Download | only in Utils

Lines Matching defs:PBI

1528     BranchInst *PBI = dyn_cast<BranchInst>(PredBlock->getTerminator());
1533 if (PBI == 0 || PBI->isUnconditional() || !SafeToMergeTerminators(BI, PBI))
1540 if (PBI->getSuccessor(0) == TrueDest)
1542 else if (PBI->getSuccessor(1) == FalseDest)
1544 else if (PBI->getSuccessor(0) == FalseDest)
1546 else if (PBI->getSuccessor(1) == TrueDest)
1566 Worklist.push_back(std::make_pair(PBI->getOperand(0), 0));
1589 DEBUG(dbgs() << "FOLDING BRANCH TO COMMON DEST:\n" << *PBI << *BB);
1590 IRBuilder<> Builder(PBI);
1594 Value *NewCond = PBI->getCondition();
1601 PBI->getCondition()->getName()+".not");
1604 PBI->setCondition(NewCond);
1605 BasicBlock *OldTrue = PBI->getSuccessor(0);
1606 BasicBlock *OldFalse = PBI->getSuccessor(1);
1607 PBI->setSuccessor(0, OldFalse);
1608 PBI->setSuccessor(1, OldTrue);
1615 PredBlock->getInstList().insert(PBI, NewBonus);
1624 PredBlock->getInstList().insert(PBI, New);
1629 cast<Instruction>(Builder.CreateBinOp(Opc, PBI->getCondition(),
1631 PBI->setCondition(NewCond);
1632 if (PBI->getSuccessor(0) == BB) {
1634 PBI->setSuccessor(0, TrueDest);
1636 if (PBI->getSuccessor(1) == BB) {
1638 PBI->setSuccessor(1, FalseDest);
1644 I->clone()->insertBefore(PBI);
1653 /// that PBI and BI are both conditional branches, and BI is in one of the
1654 /// successor blocks of PBI - PBI branches to BI.
1655 static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI) {
1656 assert(PBI->isConditional() && BI->isConditional());
1662 if (PBI->getCondition() == BI->getCondition() &&
1663 PBI->getSuccessor(0) != PBI->getSuccessor(1)) {
1668 bool CondIsTrue = PBI->getSuccessor(0) == BB;
1683 // Okay, we're going to insert the PHI node. Since PBI is not the only
1688 if ((PBI = dyn_cast<BranchInst>(P->getTerminator())) &&
1689 PBI != BI && PBI->isConditional() &&
1690 PBI->getCondition() == BI->getCondition() &&
1691 PBI->getSuccessor(0) != PBI->getSuccessor(1)) {
1692 bool CondIsTrue = PBI->getSuccessor(0) == BB;
1721 if (PBI->getSuccessor(0) == BI->getSuccessor(0))
1723 else if (PBI->getSuccessor(0) == BI->getSuccessor(1))
1725 else if (PBI->getSuccessor(1) == BI->getSuccessor(0))
1727 else if (PBI->getSuccessor(1) == BI->getSuccessor(1))
1735 if (PBI->getSuccessor(PBIOp) == BB)
1741 BasicBlock *CommonDest = PBI->getSuccessor(PBIOp);
1752 DEBUG(dbgs() << "FOLDING BRs:" << *PBI->getParent()
1772 DEBUG(dbgs() << *PBI->getParent()->getParent());
1775 // it alone, but modify PBI.
1778 Value *PBICond = PBI->getCondition();
1779 IRBuilder<true, NoFolder> Builder(PBI);
1790 // Modify PBI to branch on the new condition to the new dests.
1791 PBI->setCondition(Cond);
1792 PBI->setSuccessor(0, CommonDest);
1793 PBI->setSuccessor(1, OtherDest);
1795 // OtherDest may have phi nodes. If so, add an entry from PBI's
1797 AddPredecessorToBlock(OtherDest, PBI->getParent(), BB);
1799 // We know that the CommonDest already had an edge from PBI to
1801 // entries for BB and PBI's BB. If so, insert a select to make
1807 unsigned PBBIdx = PN->getBasicBlockIndex(PBI->getParent());
1810 // Insert a select in PBI to pick the right value.
1817 DEBUG(dbgs() << "INTO: " << *PBI->getParent());
1818 DEBUG(dbgs() << *PBI->getParent()->getParent());
2765 if (BranchInst *PBI = dyn_cast<BranchInst>((*PI)->getTerminator()))
2766 if (PBI != BI && PBI->isConditional())
2767 if (SimplifyCondBranchToCondBranch(PBI, BI))