Home | History | Annotate | Download | only in Scalar

Lines Matching refs:Phi

216 /// loop. For PHI nodes, there may be multiple uses, so compute the nearest
220 PHINode *PHI = dyn_cast<PHINode>(User);
221 if (!PHI)
225 for (unsigned i = 0, e = PHI->getNumIncomingValues(); i != e; ++i) {
226 if (PHI->getIncomingValue(i) != Def)
229 BasicBlock *InsertBB = PHI->getIncomingBlock(i);
237 assert(InsertPt && "Missing phi operand");
296 // If this is not an add of the PHI with a constantfp, or if the constant fp
500 // Collect information about PHI nodes which can be transformed in
551 // Because of LCSSA, these values will only occur in LCSSA PHI Nodes. Scan
556 // If there are no PHI nodes in this exit block, then no values defined
563 // We would like to be able to RAUW single-incoming value PHI nodes. We
564 // have to be certain this is safe even when this is an LCSSA PHI node.
568 // require an LCSSA PHI node. The safe case is when this is
569 // single-predecessor PHI node (LCSSA) and the exit block containing it is
572 // loop body as the phi node itself. Thus if it is in turn used outside of
578 // Iterate over all of the PHI nodes.
590 // watching the PHI itself. Once the new exit value is in place, there
595 // Iterate over all of the values in all the PHI nodes.
638 if (Opc == Instruction::PHI) {
639 // Do not count the Phi as a use. LCSSA may have inserted
681 for (const RewritePhi &Phi : RewritePhiSet) {
682 PHINode *PN = Phi.PN;
683 Value *ExitVal = Phi.Val;
687 if (ReplaceExitValue == OnlyCheapRepl && !LoopCanBeDel && Phi.HighCost) {
694 Instruction *Inst = cast<Instruction>(PN->getIncomingValue(Phi.Ith));
695 PN->setIncomingValue(Phi.Ith, ExitVal);
702 // If we determined that this PHI is safe to replace even if an LCSSA
703 // PHI, do so.
704 if (Phi.SafePhi) {
746 for (const RewritePhi &Phi : RewritePhiSet) {
747 unsigned i = Phi.Ith;
748 if (Phi.PN == P && (Phi.PN)->getIncomingValue(i) == Incoming) {
847 /// creating any new induction variables. To do this, it creates a new phi of
887 assert(L->getHeader() == OrigPhi->getParent() && "Phi must be an IV");
1251 DEBUG(dbgs() << "INDVARS: Widen lcssa phi " << *UsePhi
1288 // new loop phi. If we preserved IVUsers analysis, we would also want to
1354 // Handle data flow merges and bizarre phi cycles.
1373 // Is this phi an induction variable?
1392 // materialized by a loop header phi, the expression cannot have any post-loop
1396 && "Loop header phi recurrence inputs do not dominate the loop");
1399 // either find an existing phi or materialize a new one. Either way, we
1400 // expect a well-formed cyclic phi-with-increments. i.e. any operand not part
1401 // of the phi-SCC dominates the loop entry.
1561 /// Return the loop header phi IFF IncV adds a loop invariant value to the phi.
1579 PHINode *Phi = dyn_cast<PHINode>(IncI->getOperand(0));
1580 if (Phi && Phi->getParent() == L->getHeader()) {
1582 return Phi;
1589 Phi = dyn_cast<PHINode>(IncI->getOperand(1));
1590 if (Phi && Phi->getParent() == L->getHeader()) {
1592 return Phi;
1634 PHINode *Phi = dyn_cast<PHINode>(LHS);
1635 if (!Phi)
1636 Phi = getLoopPhiForCounter(LHS, L, DT);
1638 if (!Phi)
1641 // Do LFTR if PHI node is defined in the loop, but is *not* a counter.
1642 int Idx = Phi->getBasicBlockIndex(L->getLoopLatch());
1647 Value *IncV = Phi->getIncomingValue(Idx);
1648 return Phi != getLoopPhiForCounter(IncV, L, DT);
1695 static bool AlmostDeadIV(PHINode *Phi, BasicBlock *LatchBlock, Value *Cond) {
1696 int LatchIdx = Phi->getBasicBlockIndex(LatchBlock);
1697 Value *IncV = Phi->getIncomingValue(LatchIdx);
1699 for (User *U : Phi->users())
1703 Phi) return false;
1727 // Loop over all of the PHI nodes, looking for a simple counter.
1734 PHINode *Phi = cast<PHINode>(I);
1735 if (!SE->isSCEVable(Phi->getType()))
1739 if (BECount->getType()->isPointerTy() && !Phi->getType()->isPointerTy())
1742 const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(Phi));
1758 int LatchIdx = Phi->getBasicBlockIndex(LatchBlock);
1759 Value *IncV = Phi->getIncomingValue(LatchIdx);
1760 if (getLoopPhiForCounter(IncV, L, DT) != Phi)
1765 if (!hasConcreteDef(Phi)) {
1770 if (Phi != getLoopPhiForCounter(Cond->getOperand(0), L, DT)
1771 && Phi != getLoopPhiForCounter(Cond->getOperand(1), L, DT)) {
1780 if (AlmostDeadIV(Phi, LatchBlock, Cond))
1790 // narrower is likely a dead phi that has been widened. Use the wider phi
1795 BestPhi = Phi;