[PATCH] D100101: [VPlan] Add VPBasicBlock::phis() helper (NFC).

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 00:43:42 PDT 2021


Ayal added a comment.

Looks good to me!

This is aligned with BasicBlock::phis(), with a simpler implementation based on finding FirstNonPHI. Number of phi's is expected to be limited, so running twice until FirstNonPHI instead of once should be tolerable.

Would be good to document some place that all phi recipes appear before any non-phi recipe in VPBasicBlock, as in BasicBlock. (This assumption predates this patch.)



================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:1477
   inline VPRecipeBase &back() { return Recipes.back(); }
 
+  /// Returns an iterator range over the PHI-like recipes in the block.
----------------
worth adding getFirstNonPHI() and have phis() use it?


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:1483
+      VPRecipeBase *R = &*FirstNonPhi;
+      if (!isa<VPWidenIntOrFpInductionRecipe>(R) && !isa<VPWidenPHIRecipe>(R))
+        break;
----------------
worth having both these recipes inherit from a common base class, which represents all phi recipes, resulting in a single isa<> here?

once some of these header phi recipes are converted into VPInstructions, this may be more complicated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100101/new/

https://reviews.llvm.org/D100101



More information about the llvm-commits mailing list