[llvm] VPlan: introduce worklist in simplifyRecipes (PR #105699)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 23 07:00:39 PDT 2024
================
@@ -1009,8 +1015,16 @@ static void simplifyRecipes(VPlan &Plan, LLVMContext &Ctx) {
Plan.getEntry());
VPTypeAnalysis TypeInfo(Plan.getCanonicalIV()->getScalarType(), Ctx);
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
- for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
- simplifyRecipe(R, TypeInfo);
+ // Populate a Worklist, as simplifyRecipe might return a new recipe that we
----------------
ayalz wrote:
Currently, it seems something like the following change
```
for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
VPRecipeBase *NewR = simplifyRecipe(R, TypeInfo);
while (NewR)
NewR = simplifyRecipe(*NewR, TypeInfo);
}
```
would suffice, as simplifyRecipe() currently creates at most one new recipe, and the order in which recipes are simplified does not matter (right?). If/when simplifying a recipe R may create multiple new recipes, as long as only one NewR will replace all of R's uses, it may suffice to return NewR, and perhaps call recursivelySimplifyRecipes(NewR), similar to recursivelyDeleteDeadRecipes().
https://github.com/llvm/llvm-project/pull/105699
More information about the llvm-commits
mailing list