File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1757,7 +1757,8 @@ class VPWidenIntOrFpInductionRecipe : public VPHeaderPHIRecipe {
1757
1757
const InductionDescriptor &getInductionDescriptor () const { return IndDesc; }
1758
1758
1759
1759
// / Returns true if the induction is canonical, i.e. starting at 0 and
1760
- // / incremented by UF * VF (= the original IV is incremented by 1).
1760
+ // / incremented by UF * VF (= the original IV is incremented by 1) and has the
1761
+ // / same type as the canonical induction.
1761
1762
bool isCanonical () const ;
1762
1763
1763
1764
// / Returns the scalar type of the induction.
Original file line number Diff line number Diff line change @@ -1222,7 +1222,9 @@ bool VPWidenIntOrFpInductionRecipe::isCanonical() const {
1222
1222
return false ;
1223
1223
auto *StepC = dyn_cast<ConstantInt>(getStepValue ()->getLiveInIRValue ());
1224
1224
auto *StartC = dyn_cast<ConstantInt>(getStartValue ()->getLiveInIRValue ());
1225
- return StartC && StartC->isZero () && StepC && StepC->isOne ();
1225
+ auto *CanIV = cast<VPCanonicalIVPHIRecipe>(&*getParent ()->begin ());
1226
+ return StartC && StartC->isZero () && StepC && StepC->isOne () &&
1227
+ getScalarType () == CanIV->getScalarType ();
1226
1228
}
1227
1229
1228
1230
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
Original file line number Diff line number Diff line change @@ -452,8 +452,7 @@ static void removeRedundantCanonicalIVs(VPlan &Plan) {
452
452
for (VPRecipeBase &Phi : HeaderVPBB->phis ()) {
453
453
auto *WidenOriginalIV = dyn_cast<VPWidenIntOrFpInductionRecipe>(&Phi);
454
454
455
- if (!WidenOriginalIV || !WidenOriginalIV->isCanonical () ||
456
- WidenOriginalIV->getScalarType () != WidenNewIV->getScalarType ())
455
+ if (!WidenOriginalIV || !WidenOriginalIV->isCanonical ())
457
456
continue ;
458
457
459
458
// Replace WidenNewIV with WidenOriginalIV if WidenOriginalIV provides
You can’t perform that action at this time.
0 commit comments