[PATCH] D90564: [VPlan] Make VPRecipeBase inherit from VPDef.

Gil Rapaport via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 06:09:08 PST 2020


gilr requested changes to this revision.
gilr added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:622
+class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
+                     public VPDef {
   friend VPBasicBlock;
----------------
Should there be a VPRecipeBase::classof(VPDef *) to support dyn_cast from VPDef to VPRecipeBase?


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:693
 
-inline bool VPUser::classof(const VPRecipeBase *Recipe) {
-  return Recipe->getVPRecipeID() == VPRecipeBase::VPInstructionSC ||
-         Recipe->getVPRecipeID() == VPRecipeBase::VPWidenSC ||
-         Recipe->getVPRecipeID() == VPRecipeBase::VPWidenCallSC ||
-         Recipe->getVPRecipeID() == VPRecipeBase::VPWidenSelectSC ||
-         Recipe->getVPRecipeID() == VPRecipeBase::VPWidenGEPSC ||
-         Recipe->getVPRecipeID() == VPRecipeBase::VPBlendSC ||
-         Recipe->getVPRecipeID() == VPRecipeBase::VPInterleaveSC ||
-         Recipe->getVPRecipeID() == VPRecipeBase::VPReplicateSC ||
-         Recipe->getVPRecipeID() == VPRecipeBase::VPBranchOnMaskSC ||
-         Recipe->getVPRecipeID() == VPRecipeBase::VPWidenMemoryInstructionSC;
+inline bool VPUser::classof(const VPDef *Recipe) {
+  return Recipe->getVPDefID() == VPRecipeBase::VPInstructionSC ||
----------------
Recipe -> Def


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:710
 /// the VPInstruction is also a single def-use vertex.
-class VPInstruction : public VPUser, public VPValue, public VPRecipeBase {
+class VPInstruction : public VPValue, public VPUser, public VPRecipeBase {
   friend class VPlanSlp;
----------------
Worth documenting here too the importance of the inheritance order.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90564



More information about the llvm-commits mailing list