@@ -966,18 +966,6 @@ static VPValue *simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
966966 return VPC;
967967 }
968968 }
969- #ifndef NDEBUG
970- // Verify that the cached type info is for both A and its users is still
971- // accurate by comparing it to freshly computed types.
972- VPTypeAnalysis TypeInfo2 (
973- R.getParent ()->getPlan ()->getCanonicalIV ()->getScalarType ());
974- assert (TypeInfo.inferScalarType (A) == TypeInfo2.inferScalarType (A));
975- for (VPUser *U : A->users ()) {
976- auto *R = cast<VPRecipeBase>(U);
977- for (VPValue *VPV : R->definedValues ())
978- assert (TypeInfo.inferScalarType (VPV) == TypeInfo2.inferScalarType (VPV));
979- }
980- #endif
981969 }
982970
983971 // Simplify (X && Y) || (X && !Y) -> X.
@@ -1024,13 +1012,28 @@ void VPlanTransforms::simplifyRecipes(VPlan &Plan, Type &CanonicalIVTy) {
10241012 VPRecipeBase *R = Worklist.pop_back_val ();
10251013 if (VPValue *Result = simplifyRecipe (*R, TypeInfo)) {
10261014 R->getVPSingleValue ()->replaceAllUsesWith (Result);
1015+ TypeInfo.erase (R->getVPSingleValue ());
10271016 R->eraseFromParent ();
10281017 if (VPRecipeBase *ResultR = Result->getDefiningRecipe ())
10291018 Worklist.insert (ResultR);
10301019 for (VPUser *U : Result->users ())
10311020 if (auto *UR = dyn_cast<VPRecipeBase>(U))
10321021 if (UR != R)
10331022 Worklist.insert (UR);
1023+
1024+ #ifndef NDEBUG
1025+ // Verify that the cached type info is for both Result and its users is
1026+ // still accurate by comparing it to freshly computed types.
1027+ VPTypeAnalysis TypeInfo2 (&CanonicalIVTy);
1028+ assert (TypeInfo.inferScalarType (Result) ==
1029+ TypeInfo2.inferScalarType (Result));
1030+ for (VPUser *U : Result->users ()) {
1031+ auto *R = cast<VPRecipeBase>(U);
1032+ for (VPValue *VPV : R->definedValues ())
1033+ assert (TypeInfo.inferScalarType (VPV) ==
1034+ TypeInfo2.inferScalarType (VPV));
1035+ }
1036+ #endif
10341037 }
10351038 }
10361039}
0 commit comments