@@ -3122,17 +3122,6 @@ InstructionCost VPInterleaveRecipe::computeCost(ElementCount VF,
31223122 VectorTy, std::nullopt , CostKind, 0 );
31233123}
31243124
3125- void VPCanonicalIVPHIRecipe::execute (VPTransformState &State) {
3126- Value *Start = getStartValue ()->getLiveInIRValue ();
3127- PHINode *Phi = PHINode::Create (Start->getType (), 2 , " index" );
3128- Phi->insertBefore (State.CFG .PrevBB ->getFirstInsertionPt ());
3129-
3130- BasicBlock *VectorPH = State.CFG .getPreheaderBBFor (this );
3131- Phi->addIncoming (Start, VectorPH);
3132- Phi->setDebugLoc (getDebugLoc ());
3133- State.set (this , Phi, /* IsScalar*/ true );
3134- }
3135-
31363125#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
31373126void VPCanonicalIVPHIRecipe::print (raw_ostream &O, const Twine &Indent,
31383127 VPSlotTracker &SlotTracker) const {
@@ -3174,8 +3163,6 @@ void VPWidenPointerInductionRecipe::execute(VPTransformState &State) {
31743163 assert (!onlyScalarsGenerated (State.VF .isScalable ()) &&
31753164 " Recipe should have been replaced" );
31763165
3177- auto *IVR = getParent ()->getPlan ()->getCanonicalIV ();
3178- PHINode *CanonicalIV = cast<PHINode>(State.get (IVR, /* IsScalar*/ true ));
31793166 unsigned CurrentPart = getUnrollPart (*this );
31803167
31813168 // Build a pointer phi
@@ -3185,6 +3172,12 @@ void VPWidenPointerInductionRecipe::execute(VPTransformState &State) {
31853172 BasicBlock *VectorPH = State.CFG .getPreheaderBBFor (this );
31863173 PHINode *NewPointerPhi = nullptr ;
31873174 if (CurrentPart == 0 ) {
3175+ auto *IVR = cast<VPHeaderPHIRecipe>(&getParent ()
3176+ ->getPlan ()
3177+ ->getVectorLoopRegion ()
3178+ ->getEntryBasicBlock ()
3179+ ->front ());
3180+ PHINode *CanonicalIV = cast<PHINode>(State.get (IVR, /* IsScalar*/ true ));
31883181 NewPointerPhi = PHINode::Create (ScStValueType, 2 , " pointer.phi" ,
31893182 CanonicalIV->getIterator ());
31903183 NewPointerPhi->addIncoming (ScalarStartValue, VectorPH);
@@ -3495,20 +3488,30 @@ void VPActiveLaneMaskPHIRecipe::print(raw_ostream &O, const Twine &Indent,
34953488}
34963489#endif
34973490
3498- void VPEVLBasedIVPHIRecipe::execute (VPTransformState &State) {
3491+ #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
3492+ void VPEVLBasedIVPHIRecipe::print (raw_ostream &O, const Twine &Indent,
3493+ VPSlotTracker &SlotTracker) const {
3494+ O << Indent << " EXPLICIT-VECTOR-LENGTH-BASED-IV-PHI " ;
3495+
3496+ printAsOperand (O, SlotTracker);
3497+ O << " = phi " ;
3498+ printOperands (O, SlotTracker);
3499+ }
3500+ #endif
3501+
3502+ void VPScalarPHIRecipe::execute (VPTransformState &State) {
34993503 BasicBlock *VectorPH = State.CFG .getPreheaderBBFor (this );
35003504 Value *Start = State.get (getOperand (0 ), VPLane (0 ));
3501- PHINode *Phi = State.Builder .CreatePHI (Start->getType (), 2 , " evl.based.iv " );
3505+ PHINode *Phi = State.Builder .CreatePHI (Start->getType (), 2 , Name );
35023506 Phi->addIncoming (Start, VectorPH);
35033507 Phi->setDebugLoc (getDebugLoc ());
35043508 State.set (this , Phi, /* IsScalar=*/ true );
35053509}
35063510
35073511#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
3508- void VPEVLBasedIVPHIRecipe::print (raw_ostream &O, const Twine &Indent,
3509- VPSlotTracker &SlotTracker) const {
3510- O << Indent << " EXPLICIT-VECTOR-LENGTH-BASED-IV-PHI " ;
3511-
3512+ void VPScalarPHIRecipe::print (raw_ostream &O, const Twine &Indent,
3513+ VPSlotTracker &SlotTracker) const {
3514+ O << Indent << " SCALAR-PHI" ;
35123515 printAsOperand (O, SlotTracker);
35133516 O << " = phi " ;
35143517 printOperands (O, SlotTracker);
0 commit comments