Home | History | Annotate | Download | only in Scalar

Lines Matching defs:Phi

182 /// loop. For PHI nodes, there may be multiple uses, so compute the nearest
186 PHINode *PHI = dyn_cast<PHINode>(User);
187 if (!PHI)
191 for (unsigned i = 0, e = PHI->getNumIncomingValues(); i != e; ++i) {
192 if (PHI->getIncomingValue(i) != Def)
195 BasicBlock *InsertBB = PHI->getIncomingBlock(i);
203 assert(InsertPt && "Missing phi operand");
262 // If this is not an add of the PHI with a constantfp, or if the constant fp
466 // Collect information about PHI nodes which can be transformed in
516 // Because of LCSSA, these values will only occur in LCSSA PHI Nodes. Scan
519 // If there are no PHI nodes in this exit block, then no values defined
526 // Iterate over all of the PHI nodes.
537 // watching the PHI itself. Once the new exit value is in place, there
542 // Iterate over all of the values in all the PHI nodes.
585 if (Opc == Instruction::PHI) {
586 // Do not count the Phi as a use. LCSSA may have inserted
627 for (const RewritePhi &Phi : RewritePhiSet) {
628 PHINode *PN = Phi.PN;
629 Value *ExitVal = Phi.Val;
633 if (ReplaceExitValue == OnlyCheapRepl && !LoopCanBeDel && Phi.HighCost) {
640 Instruction *Inst = cast<Instruction>(PN->getIncomingValue(Phi.Ith));
641 PN->setIncomingValue(Phi.Ith, ExitVal);
668 /// loop iteration. This lets us predict exit values of PHI nodes that live in
681 // If there are no more PHI nodes in this exit block, then no more
718 // If ExitVal is a PHI on the loop header, then we know its
766 for (const RewritePhi &Phi : RewritePhiSet) {
767 unsigned i = Phi.Ith;
768 if (Phi.PN == P && (Phi.PN)->getIncomingValue(i) == Incoming) {
867 /// creating any new induction variables. To do this, it creates a new phi of
907 assert(L->getHeader() == OrigPhi->getParent() && "Phi must be an IV");
1263 // Widening the PHI requires us to insert a trunc. The logical place
1264 // for this trunc is in the same BB as the PHI. This is not possible if
1277 DEBUG(dbgs() << "INDVARS: Widen lcssa phi " << *UsePhi
1314 // new loop phi. If we preserved IVUsers analysis, we would also want to
1379 // Handle data flow merges and bizarre phi cycles.
1397 // Is this phi an induction variable?
1416 // materialized by a loop header phi, the expression cannot have any post-loop
1421 "Loop header phi recurrence inputs do not dominate the loop");
1424 // either find an existing phi or materialize a new one. Either way, we
1425 // expect a well-formed cyclic phi-with-increments. i.e. any operand not part
1426 // of the phi-SCC dominates the loop entry.
1584 /// Return the loop header phi IFF IncV adds a loop invariant value to the phi.
1602 PHINode *Phi = dyn_cast<PHINode>(IncI->getOperand(0));
1603 if (Phi && Phi->getParent() == L->getHeader()) {
1605 return Phi;
1612 Phi = dyn_cast<PHINode>(IncI->getOperand(1));
1613 if (Phi && Phi->getParent() == L->getHeader()) {
1615 return Phi;
1657 PHINode *Phi = dyn_cast<PHINode>(LHS);
1658 if (!Phi)
1659 Phi = getLoopPhiForCounter(LHS, L, DT);
1661 if (!Phi)
1664 // Do LFTR if PHI node is defined in the loop, but is *not* a counter.
1665 int Idx = Phi->getBasicBlockIndex(L->getLoopLatch());
1670 Value *IncV = Phi->getIncomingValue(Idx);
1671 return Phi != getLoopPhiForCounter(IncV, L, DT);
1718 static bool AlmostDeadIV(PHINode *Phi, BasicBlock *LatchBlock, Value *Cond) {
1719 int LatchIdx = Phi->getBasicBlockIndex(LatchBlock);
1720 Value *IncV = Phi->getIncomingValue(LatchIdx);
1722 for (User *U : Phi->users())
1726 if (U != Cond && U != Phi) return false;
1750 // Loop over all of the PHI nodes, looking for a simple counter.
1758 PHINode *Phi = cast<PHINode>(I);
1759 if (!SE->isSCEVable(Phi->getType()))
1763 if (BECount->getType()->isPointerTy() && !Phi->getType()->isPointerTy())
1766 const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(Phi));
1781 int LatchIdx = Phi->getBasicBlockIndex(LatchBlock);
1782 Value *IncV = Phi->getIncomingValue(LatchIdx);
1783 if (getLoopPhiForCounter(IncV, L, DT) != Phi)
1788 if (!hasConcreteDef(Phi)) {
1793 if (Phi != getLoopPhiForCounter(Cond->getOperand(0), L, DT) &&
1794 Phi != getLoopPhiForCounter(Cond->getOperand(1), L, DT)) {
1803 if (AlmostDeadIV(Phi, LatchBlock, Cond))
1813 // narrower is likely a dead phi that has been widened. Use the wider phi
1818 BestPhi = Phi;