@@ -3096,17 +3096,6 @@ InstructionCost VPInterleaveRecipe::computeCost(ElementCount VF,
30963096 VectorTy, std::nullopt , CostKind, 0 );
30973097}
30983098
3099- void VPCanonicalIVPHIRecipe::execute (VPTransformState &State) {
3100- Value *Start = getStartValue ()->getLiveInIRValue ();
3101- PHINode *Phi = PHINode::Create (Start->getType (), 2 , " index" );
3102- Phi->insertBefore (State.CFG .PrevBB ->getFirstInsertionPt ());
3103-
3104- BasicBlock *VectorPH = State.CFG .getPreheaderBBFor (this );
3105- Phi->addIncoming (Start, VectorPH);
3106- Phi->setDebugLoc (getDebugLoc ());
3107- State.set (this , Phi, /* IsScalar*/ true );
3108- }
3109-
31103099#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
31113100void VPCanonicalIVPHIRecipe::print (raw_ostream &O, const Twine &Indent,
31123101 VPSlotTracker &SlotTracker) const {
@@ -3148,8 +3137,6 @@ void VPWidenPointerInductionRecipe::execute(VPTransformState &State) {
31483137 assert (!onlyScalarsGenerated (State.VF .isScalable ()) &&
31493138 " Recipe should have been replaced" );
31503139
3151- auto *IVR = getParent ()->getPlan ()->getCanonicalIV ();
3152- PHINode *CanonicalIV = cast<PHINode>(State.get (IVR, /* IsScalar*/ true ));
31533140 unsigned CurrentPart = getUnrollPart (*this );
31543141
31553142 // Build a pointer phi
@@ -3159,6 +3146,12 @@ void VPWidenPointerInductionRecipe::execute(VPTransformState &State) {
31593146 BasicBlock *VectorPH = State.CFG .getPreheaderBBFor (this );
31603147 PHINode *NewPointerPhi = nullptr ;
31613148 if (CurrentPart == 0 ) {
3149+ auto *IVR = cast<VPHeaderPHIRecipe>(&getParent ()
3150+ ->getPlan ()
3151+ ->getVectorLoopRegion ()
3152+ ->getEntryBasicBlock ()
3153+ ->front ());
3154+ PHINode *CanonicalIV = cast<PHINode>(State.get (IVR, /* IsScalar*/ true ));
31623155 NewPointerPhi = PHINode::Create (ScStValueType, 2 , " pointer.phi" ,
31633156 CanonicalIV->getIterator ());
31643157 NewPointerPhi->addIncoming (ScalarStartValue, VectorPH);
@@ -3469,20 +3462,30 @@ void VPActiveLaneMaskPHIRecipe::print(raw_ostream &O, const Twine &Indent,
34693462}
34703463#endif
34713464
3472- void VPEVLBasedIVPHIRecipe::execute (VPTransformState &State) {
3465+ #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
3466+ void VPEVLBasedIVPHIRecipe::print (raw_ostream &O, const Twine &Indent,
3467+ VPSlotTracker &SlotTracker) const {
3468+ O << Indent << " EXPLICIT-VECTOR-LENGTH-BASED-IV-PHI " ;
3469+
3470+ printAsOperand (O, SlotTracker);
3471+ O << " = phi " ;
3472+ printOperands (O, SlotTracker);
3473+ }
3474+ #endif
3475+
3476+ void VPScalarPHIRecipe::execute (VPTransformState &State) {
34733477 BasicBlock *VectorPH = State.CFG .getPreheaderBBFor (this );
34743478 Value *Start = State.get (getOperand (0 ), VPLane (0 ));
3475- PHINode *Phi = State.Builder .CreatePHI (Start->getType (), 2 , " evl.based.iv " );
3479+ PHINode *Phi = State.Builder .CreatePHI (Start->getType (), 2 , Name );
34763480 Phi->addIncoming (Start, VectorPH);
34773481 Phi->setDebugLoc (getDebugLoc ());
34783482 State.set (this , Phi, /* IsScalar=*/ true );
34793483}
34803484
34813485#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
3482- void VPEVLBasedIVPHIRecipe::print (raw_ostream &O, const Twine &Indent,
3483- VPSlotTracker &SlotTracker) const {
3484- O << Indent << " EXPLICIT-VECTOR-LENGTH-BASED-IV-PHI " ;
3485-
3486+ void VPScalarPHIRecipe::print (raw_ostream &O, const Twine &Indent,
3487+ VPSlotTracker &SlotTracker) const {
3488+ O << Indent << " SCALAR-PHI" ;
34863489 printAsOperand (O, SlotTracker);
34873490 O << " = phi " ;
34883491 printOperands (O, SlotTracker);
0 commit comments