@@ -966,18 +966,6 @@ static VPValue *simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
966
966
return VPC;
967
967
}
968
968
}
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
981
969
}
982
970
983
971
// Simplify (X && Y) || (X && !Y) -> X.
@@ -1021,13 +1009,28 @@ void VPlanTransforms::simplifyRecipes(VPlan &Plan, Type &CanonicalIVTy) {
1021
1009
VPRecipeBase *R = Worklist.pop_back_val ();
1022
1010
if (VPValue *Result = simplifyRecipe (*R, TypeInfo)) {
1023
1011
R->getVPSingleValue ()->replaceAllUsesWith (Result);
1012
+ TypeInfo.erase (R->getVPSingleValue ());
1024
1013
R->eraseFromParent ();
1025
1014
if (VPRecipeBase *ResultR = Result->getDefiningRecipe ())
1026
1015
Worklist.insert (ResultR);
1027
1016
for (VPUser *U : Result->users ())
1028
1017
if (auto *UR = dyn_cast<VPRecipeBase>(U))
1029
1018
if (UR != R)
1030
1019
Worklist.insert (UR);
1020
+
1021
+ #ifndef NDEBUG
1022
+ // Verify that the cached type info is for both Result and its users is
1023
+ // still accurate by comparing it to freshly computed types.
1024
+ VPTypeAnalysis TypeInfo2 (&CanonicalIVTy);
1025
+ assert (TypeInfo.inferScalarType (Result) ==
1026
+ TypeInfo2.inferScalarType (Result));
1027
+ for (VPUser *U : Result->users ()) {
1028
+ auto *R = cast<VPRecipeBase>(U);
1029
+ for (VPValue *VPV : R->definedValues ())
1030
+ assert (TypeInfo.inferScalarType (VPV) ==
1031
+ TypeInfo2.inferScalarType (VPV));
1032
+ }
1033
+ #endif
1031
1034
}
1032
1035
}
1033
1036
}
0 commit comments