diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -1139,6 +1139,7 @@ B->getVPDefID() == VPRecipeBase::VPFirstOrderRecurrencePHISC || B->getVPDefID() == VPRecipeBase::VPReductionPHISC || B->getVPDefID() == VPRecipeBase::VPWidenIntOrFpInductionSC || + B->getVPDefID() == VPRecipeBase::VPWidenPointerInductionSC || B->getVPDefID() == VPRecipeBase::VPWidenPHISC; } static inline bool classof(const VPValue *V) { @@ -1147,6 +1148,7 @@ V->getVPValueID() == VPValue::VPVFirstOrderRecurrencePHISC || V->getVPValueID() == VPValue::VPVReductionPHISC || V->getVPValueID() == VPValue::VPVWidenIntOrFpInductionSC || + V->getVPValueID() == VPValue::VPVWidenPointerInductionSC || V->getVPValueID() == VPValue::VPVWidenPHISC; } diff --git a/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp b/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp --- a/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp @@ -141,9 +141,31 @@ auto RecipeI = VPBB->begin(); auto End = VPBB->end(); unsigned NumActiveLaneMaskPhiRecipes = 0; + const VPRegionBlock *ParentR = VPBB->getParent(); + bool IsHeaderVPBB = ParentR && !ParentR->isReplicator() && + ParentR->getEntryBasicBlock() == VPBB; while (RecipeI != End && RecipeI->isPhi()) { if (isa(RecipeI)) NumActiveLaneMaskPhiRecipes++; + + if (IsHeaderVPBB && !isa(*RecipeI)) { + errs() << "Found non-header PHI recipe in header VPBB"; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + errs() << ": "; + RecipeI->dump(); +#endif + return false; + } + + if (!IsHeaderVPBB && isa(*RecipeI)) { + errs() << "Found header PHI recipe in non-header VPBB"; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + errs() << ": "; + RecipeI->dump(); +#endif + return false; + } + RecipeI++; }