[llvm] VPlan: introduce worklist in simplifyRecipes (PR #105699)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 13:53:26 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
+ // need to re-process.
+ SmallVector<VPRecipeBase *> Worklist;
+ for (auto &R : VPBB->getRecipeList())
+ Worklist.push_back(&R);
+
+ while (!Worklist.empty()) {
+ VPRecipeBase *R = Worklist.pop_back_val();
+ for (VPRecipeBase *Cand : simplifyRecipe(*R, TypeInfo))
+ Worklist.push_back(Cand);
----------------
fhahn wrote:
Thanks for splitting this off. A next step could be for the work-list to also re-queue users of a simplified value for further simplification. With the current interface, we would have to create and return a number of temporary vectors for each simplification. Just wondering what your thoughts are about adding the the worklist in `simplifyRecipe`
https://github.com/llvm/llvm-project/pull/105699
More information about the llvm-commits
mailing list