Home | History | Annotate | Download | only in Scalar

Lines Matching refs:Phi

188 /// loop. For PHI nodes, there may be multiple uses, so compute the nearest
192 PHINode *PHI = dyn_cast<PHINode>(User);
193 if (!PHI)
197 for (unsigned i = 0, e = PHI->getNumIncomingValues(); i != e; ++i) {
198 if (PHI->getIncomingValue(i) != Def)
201 BasicBlock *InsertBB = PHI->getIncomingBlock(i);
209 assert(InsertPt && "Missing phi operand");
259 // If this is not an add of the PHI with a constantfp, or if the constant fp
485 // Because of LCSSA, these values will only occur in LCSSA PHI Nodes. Scan
490 // If there are no PHI nodes in this exit block, then no values defined
497 // Iterate over all of the PHI nodes.
509 // watching the PHI itself. Once the new exit value is in place, there
514 // Iterate over all of the values in all the PHI nodes.
558 // Completely replace a single-pred PHI. This is safe, because the
559 // NewVal won't be variant in the loop, so we don't need an LCSSA phi
566 // Clone the PHI and delete the original one. This lets IVUsers and
659 /// phi of the wider type and redirects all users, either removing extends or
698 assert(L->getHeader() == OrigPhi->getParent() && "Phi must be an IV");
894 // new loop phi. If we preserved IVUsers analysis, we would also want to
954 // Handle data flow merges and bizarre phi cycles.
973 // Is this phi an induction variable?
992 // materialized by a loop header phi, the expression cannot have any post-loop
996 && "Loop header phi recurrence inputs do not dominate the loop");
999 // either find an existing phi or materialize a new one. Either way, we
1000 // expect a well-formed cyclic phi-with-increments. i.e. any operand not part
1001 // of the phi-SCC dominates the loop entry.
1183 /// getLoopPhiForCounter - Return the loop header phi IFF IncV adds a loop
1184 /// invariant value to the phi.
1202 PHINode *Phi = dyn_cast<PHINode>(IncI->getOperand(0));
1203 if (Phi && Phi->getParent() == L->getHeader()) {
1205 return Phi;
1212 Phi = dyn_cast<PHINode>(IncI->getOperand(1));
1213 if (Phi && Phi->getParent() == L->getHeader()) {
1215 return Phi;
1257 PHINode *Phi = dyn_cast<PHINode>(LHS);
1258 if (!Phi)
1259 Phi = getLoopPhiForCounter(LHS, L, DT);
1261 if (!Phi)
1264 // Do LFTR if PHI node is defined in the loop, but is *not* a counter.
1265 int Idx = Phi->getBasicBlockIndex(L->getLoopLatch());
1270 Value *IncV = Phi->getIncomingValue(Idx);
1271 return Phi != getLoopPhiForCounter(IncV, L, DT);
1318 static bool AlmostDeadIV(PHINode *Phi, BasicBlock *LatchBlock, Value *Cond) {
1319 int LatchIdx = Phi->getBasicBlockIndex(LatchBlock);
1320 Value *IncV = Phi->getIncomingValue(LatchIdx);
1322 for (Value::use_iterator UI = Phi->use_begin(), UE = Phi->use_end();
1329 if (*UI != Cond && *UI != Phi) return false;
1355 // Loop over all of the PHI nodes, looking for a simple counter.
1362 PHINode *Phi = cast<PHINode>(I);
1363 if (!SE->isSCEVable(Phi->getType()))
1367 if (BECount->getType()->isPointerTy() && !Phi->getType()->isPointerTy())
1370 const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(Phi));
1385 int LatchIdx = Phi->getBasicBlockIndex(LatchBlock);
1386 Value *IncV = Phi->getIncomingValue(LatchIdx);
1387 if (getLoopPhiForCounter(IncV, L, DT) != Phi)
1392 if (!hasConcreteDef(Phi)) {
1397 if (Phi != getLoopPhiForCounter(Cond->getOperand(0), L, DT)
1398 && Phi != getLoopPhiForCounter(Cond->getOperand(1), L, DT)) {
1407 if (AlmostDeadIV(Phi, LatchBlock, Cond))
1417 // narrower is likely a dead phi that has been widened. Use the wider phi
1422 BestPhi = Phi;