Home | History | Annotate | Download | only in Scalar

Lines Matching defs:Phi

192 /// loop. For PHI nodes, there may be multiple uses, so compute the nearest
196 PHINode *PHI = dyn_cast<PHINode>(User);
197 if (!PHI)
201 for (unsigned i = 0, e = PHI->getNumIncomingValues(); i != e; ++i) {
202 if (PHI->getIncomingValue(i) != Def)
205 BasicBlock *InsertBB = PHI->getIncomingBlock(i);
213 assert(InsertPt && "Missing phi operand");
263 // If this is not an add of the PHI with a constantfp, or if the constant fp
489 // Because of LCSSA, these values will only occur in LCSSA PHI Nodes. Scan
494 // If there are no PHI nodes in this exit block, then no values defined
501 // We would like to be able to RAUW single-incoming value PHI nodes. We
502 // have to be certain this is safe even when this is an LCSSA PHI node.
506 // require an LCSSA PHI node. The safe case is when this is
507 // single-predecessor PHI node (LCSSA) and the exit block containing it is
510 // loop body as the phi node itself. Thus if it is in turn used outside of
516 // Iterate over all of the PHI nodes.
528 // watching the PHI itself. Once the new exit value is in place, there
533 // Iterate over all of the values in all the PHI nodes.
576 if (Opc == Instruction::PHI) {
577 // Do not count the Phi as a use. LCSSA may have inserted
616 // If we determined that this PHI is safe to replace even if an LCSSA
617 // PHI, do so.
624 // If we were unable to completely replace the PHI node, clone the PHI
706 /// phi of the wider type and redirects all users, either removing extends or
745 assert(L->getHeader() == OrigPhi->getParent() && "Phi must be an IV");
932 DEBUG(dbgs() << "INDVARS: Widen lcssa phi " << *UsePhi
969 // new loop phi. If we preserved IVUsers analysis, we would also want to
1026 // Handle data flow merges and bizarre phi cycles.
1045 // Is this phi an induction variable?
1064 // materialized by a loop header phi, the expression cannot have any post-loop
1068 && "Loop header phi recurrence inputs do not dominate the loop");
1071 // either find an existing phi or materialize a new one. Either way, we
1072 // expect a well-formed cyclic phi-with-increments. i.e. any operand not part
1073 // of the phi-SCC dominates the loop entry.
1282 /// getLoopPhiForCounter - Return the loop header phi IFF IncV adds a loop
1283 /// invariant value to the phi.
1301 PHINode *Phi = dyn_cast<PHINode>(IncI->getOperand(0));
1302 if (Phi && Phi->getParent() == L->getHeader()) {
1304 return Phi;
1311 Phi = dyn_cast<PHINode>(IncI->getOperand(1));
1312 if (Phi && Phi->getParent() == L->getHeader()) {
1314 return Phi;
1356 PHINode *Phi = dyn_cast<PHINode>(LHS);
1357 if (!Phi)
1358 Phi = getLoopPhiForCounter(LHS, L, DT);
1360 if (!Phi)
1363 // Do LFTR if PHI node is defined in the loop, but is *not* a counter.
1364 int Idx = Phi->getBasicBlockIndex(L->getLoopLatch());
1369 Value *IncV = Phi->getIncomingValue(Idx);
1370 return Phi != getLoopPhiForCounter(IncV, L, DT);
1417 static bool AlmostDeadIV(PHINode *Phi, BasicBlock *LatchBlock, Value *Cond) {
1418 int LatchIdx = Phi->getBasicBlockIndex(LatchBlock);
1419 Value *IncV = Phi->getIncomingValue(LatchIdx);
1421 for (User *U : Phi->users())
1425 if (U != Cond && U != Phi) return false;
1450 // Loop over all of the PHI nodes, looking for a simple counter.
1457 PHINode *Phi = cast<PHINode>(I);
1458 if (!SE->isSCEVable(Phi->getType()))
1462 if (BECount->getType()->isPointerTy() && !Phi->getType()->isPointerTy())
1465 const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(Phi));
1480 int LatchIdx = Phi->getBasicBlockIndex(LatchBlock);
1481 Value *IncV = Phi->getIncomingValue(LatchIdx);
1482 if (getLoopPhiForCounter(IncV, L, DT) != Phi)
1487 if (!hasConcreteDef(Phi)) {
1492 if (Phi != getLoopPhiForCounter(Cond->getOperand(0), L, DT)
1493 && Phi != getLoopPhiForCounter(Cond->getOperand(1), L, DT)) {
1502 if (AlmostDeadIV(Phi, LatchBlock, Cond))
1512 // narrower is likely a dead phi that has been widened. Use the wider phi
1517 BestPhi = Phi;