@@ -8844,37 +8844,28 @@ static VPValue *addResumeValuesForInduction(VPHeaderPHIRecipe *PhiR,
88448844 VPBuilder &ScalarPHBuilder,
88458845 VPTypeAnalysis &TypeInfo,
88468846 VPValue *VectorTC) {
8847- PHINode *OrigPhi;
8848- const InductionDescriptor *ID;
8849- VPValue *Start = PhiR->getStartValue ();
8850- VPValue *Step;
8851- Type *ScalarTy;
8847+ auto *WideIV = dyn_cast<VPWidenInductionRecipe>(PhiR);
8848+ if (!WideIV)
8849+ return nullptr ;
8850+
8851+ VPValue *Start = WideIV->getStartValue ();
8852+ VPValue *Step = WideIV->getStepValue ();
8853+ const InductionDescriptor &ID = WideIV->getInductionDescriptor ();
8854+ Type *ScalarTy = TypeInfo.inferScalarType (WideIV);
88528855 bool IsCanonical = false ;
88538856 if (auto *WideIV = dyn_cast<VPWidenIntOrFpInductionRecipe>(PhiR)) {
88548857 // Truncated wide inductions resume from the last lane of their vector value
88558858 // in the last vector iteration.
8856- if (WideIV-> getTruncInst ( ))
8859+ if (ScalarTy != TypeInfo. inferScalarType (Step ))
88578860 return nullptr ;
8858- OrigPhi = cast<PHINode>(WideIV->getUnderlyingValue ());
8859- ID = &WideIV->getInductionDescriptor ();
8860- Step = WideIV->getStepValue ();
8861- ScalarTy = WideIV->getScalarType ();
88628861 IsCanonical = WideIV->isCanonical ();
8863- } else if (auto *WideIV = dyn_cast<VPWidenPointerInductionRecipe>(PhiR)) {
8864- OrigPhi = cast<PHINode>(WideIV->getUnderlyingValue ());
8865- ID = &WideIV->getInductionDescriptor ();
8866- Step = WideIV->getOperand (1 );
8867- ScalarTy = Start->getLiveInIRValue ()->getType ();
8868- } else {
8869- return nullptr ;
88708862 }
88718863
88728864 VPValue *EndValue = VectorTC;
88738865 if (!IsCanonical) {
88748866 EndValue = VectorPHBuilder.createDerivedIV (
8875- ID->getKind (),
8876- dyn_cast_or_null<FPMathOperator>(ID->getInductionBinOp ()), Start,
8877- VectorTC, Step);
8867+ ID.getKind (), dyn_cast_or_null<FPMathOperator>(ID.getInductionBinOp ()),
8868+ Start, VectorTC, Step);
88788869 }
88798870
88808871 // EndValue is based on the vector trip count (which has the same type as the
@@ -8886,7 +8877,7 @@ static VPValue *addResumeValuesForInduction(VPHeaderPHIRecipe *PhiR,
88868877
88878878 auto *ResumePhiRecipe =
88888879 ScalarPHBuilder.createNaryOp (VPInstruction::ResumePhi, {EndValue, Start},
8889- OrigPhi ->getDebugLoc (), " bc.resume.val" );
8880+ WideIV ->getDebugLoc (), " bc.resume.val" );
88908881 return ResumePhiRecipe;
88918882}
88928883
0 commit comments