@@ -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.
@@ -1024,13 +1012,28 @@ void VPlanTransforms::simplifyRecipes(VPlan &Plan, Type &CanonicalIVTy) {
1024
1012
VPRecipeBase *R = Worklist.pop_back_val ();
1025
1013
if (VPValue *Result = simplifyRecipe (*R, TypeInfo)) {
1026
1014
R->getVPSingleValue ()->replaceAllUsesWith (Result);
1015
+ TypeInfo.erase (R->getVPSingleValue ());
1027
1016
R->eraseFromParent ();
1028
1017
if (VPRecipeBase *ResultR = Result->getDefiningRecipe ())
1029
1018
Worklist.insert (ResultR);
1030
1019
for (VPUser *U : Result->users ())
1031
1020
if (auto *UR = dyn_cast<VPRecipeBase>(U))
1032
1021
if (UR != R)
1033
1022
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
1034
1037
}
1035
1038
}
1036
1039
}
0 commit comments