Home | History | Annotate | Download | only in Utils

Lines Matching refs:Phi

70 RecurrenceDescriptor::lookThroughAnd(PHINode *Phi, Type *&RT,
73 if (!Phi->hasOneUse())
74 return Phi;
77 Instruction *I, *J = cast<Instruction>(Phi->use_begin()->getUser());
85 RT = IntegerType::get(Phi->getContext(), Bits);
86 Visited.insert(Phi);
91 return Phi;
155 bool RecurrenceDescriptor::AddReductionVar(PHINode *Phi, RecurrenceKind Kind,
158 if (Phi->getNumIncomingValues() != 2)
162 if (Phi->getParent() != TheLoop->getHeader())
167 Value *RdxStart = Phi->getIncomingValueForBlock(TheLoop->getLoopPreheader());
172 // which ends in the phi node).
177 // We start with the PHI node and scan for all of the users of this
180 // must include the original PHI.
190 Type *RecurrenceType = Phi->getType();
192 Instruction *Start = Phi;
198 // Return early if the recurrence kind does not match the type of Phi. If the
210 Start = lookThroughAnd(Phi, RecurrenceType, VisitedInsts, CastInsts);
221 // - PHI:
222 // - All uses of the PHI must be the reduction (safe).
228 // * An instruction type other than PHI or the reduction operation.
229 // * A PHI in the header other than the initial PHI.
242 // A header PHI use other than the original PHI.
243 if (Cur != Phi && IsAPhi && Cur->getParent() == Phi->getParent())
254 // the starting value (the Phi or an AND instruction if the Phi has been
267 // All inputs to a PHI node must be a reduction value.
268 if (IsAPhi && Cur != Phi && !areAllUsesIn(Cur, VisitedInsts))
280 // Process users of current instruction. Push non-PHI nodes after PHI nodes
281 // onto the stack. This way we are going to have seen all inputs to PHI
291 // Exit if you find multiple outside users or if the header phi node is
295 if (ExitInstruction != nullptr || Cur == Phi)
299 // before we feed back to the reduction phi. Otherwise, we loose VF-1
301 if (std::find(Phi->op_begin(), Phi->op_end(), Cur) == Phi->op_end())
309 // value must only be used once, except by phi nodes and min/max
324 if (UI == Phi)
340 // If we think Phi may have been type-promoted, we also need to ensure that
343 if (Start != Phi)
348 // We found a reduction var if we have reached the original phi node and we
425 case Instruction::PHI:
466 bool RecurrenceDescriptor::isReductionPHI(PHINode *Phi, Loop *TheLoop,
476 if (AddReductionVar(Phi, RK_IntegerAdd, TheLoop, HasFunNoNaNAttr, RedDes)) {
477 DEBUG(dbgs() << "Found an ADD reduction PHI." << *Phi << "\n");
480 if (AddReductionVar(Phi, RK_IntegerMult, TheLoop, HasFunNoNaNAttr, RedDes)) {
481 DEBUG(dbgs() << "Found a MUL reduction PHI." << *Phi << "\n");
484 if (AddReductionVar(Phi, RK_IntegerOr, TheLoop, HasFunNoNaNAttr, RedDes)) {
485 DEBUG(dbgs() << "Found an OR reduction PHI." << *Phi << "\n");
488 if (AddReductionVar(Phi, RK_IntegerAnd, TheLoop, HasFunNoNaNAttr, RedDes)) {
489 DEBUG(dbgs() << "Found an AND reduction PHI." << *Phi << "\n");
492 if (AddReductionVar(Phi, RK_IntegerXor, TheLoop, HasFunNoNaNAttr, RedDes)) {
493 DEBUG(dbgs() << "Found a XOR reduction PHI." << *Phi << "\n");
496 if (AddReductionVar(Phi, RK_IntegerMinMax, TheLoop, HasFunNoNaNAttr,
498 DEBUG(dbgs() << "Found a MINMAX reduction PHI." << *Phi << "\n");
501 if (AddReductionVar(Phi, RK_FloatMult, TheLoop, HasFunNoNaNAttr, RedDes)) {
502 DEBUG(dbgs() << "Found an FMult reduction PHI." << *Phi << "\n");
505 if (AddReductionVar(Phi, RK_FloatAdd, TheLoop, HasFunNoNaNAttr, RedDes)) {
506 DEBUG(dbgs() << "Found an FAdd reduction PHI." << *Phi << "\n");
509 if (AddReductionVar(Phi, RK_FloatMinMax, TheLoop, HasFunNoNaNAttr, RedDes)) {
510 DEBUG(dbgs() << "Found an float MINMAX reduction PHI." << *Phi << "\n");
660 bool InductionDescriptor::isInductionPHI(PHINode *Phi, ScalarEvolution *SE,
662 Type *PhiTy = Phi->getType();
667 // Check that the PHI is consecutive.
668 const SCEV *PhiScev = SE->getSCEV(Phi);
671 DEBUG(dbgs() << "LV: PHI is not a poly recurrence.\n");
675 assert(AR->getLoop()->getHeader() == Phi->getParent() &&
676 "PHI is an AddRec for a different loop?!");
678 Phi->getIncomingValueForBlock(AR->getLoop()->getLoopPreheader());
691 assert(PhiTy->isPointerTy() && "The PHI must be a pointer");
698 const DataLayout &DL = Phi->getModule()->getDataLayout();