@@ -890,10 +890,29 @@ class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
890890 bool mayHaveSideEffects () const ;
891891
892892 // / Returns true for PHI-like recipes.
893- bool isPhi () const {
893+ virtual bool isPhi () const {
894+ assert (getVPDefID () != VPInstructionSC &&
895+ " VPInstructions implement this function themselves" );
894896 return getVPDefID () >= VPFirstPHISC && getVPDefID () <= VPLastPHISC;
895897 }
896898
899+ // / Returns true for PHI-like recipes that exists in vector loop header basic
900+ // / block
901+ virtual bool isHeaderPhi () const {
902+ assert (getVPDefID () != VPInstructionSC &&
903+ " VPInstructions implement this function themselves" );
904+ return (getVPDefID () >= VPFirstHeaderPHISC &&
905+ getVPDefID () <= VPLastHeaderPHISC) ||
906+ getVPDefID () == VPWidenPHISC;
907+ }
908+
909+ // / Returns true for PHI-like recipes that generate their own backedge
910+ virtual bool isPhiThatGeneratesBackedge () const {
911+ assert (getVPDefID () != VPInstructionSC &&
912+ " VPInstructions implement this function themselves" );
913+ return getVPDefID () == VPWidenPHISC || getVPDefID () == VPCSAHeaderPHISC;
914+ }
915+
897916 // / Returns true if the recipe may read from memory.
898917 bool mayReadFromMemory () const ;
899918
@@ -1459,6 +1478,16 @@ class VPInstruction : public VPRecipeWithIRFlags {
14591478 // / Returns true if this VPInstruction's operands are single scalars and the
14601479 // / result is also a single scalar.
14611480 bool isSingleScalar () const ;
1481+
1482+ // / Returns true for PHI-like recipes.
1483+ bool isPhi () const override ;
1484+
1485+ // / Returns true for PHI-like recipes that exists in vector loop header basic
1486+ // / block
1487+ bool isHeaderPhi () const override ;
1488+
1489+ // / Returns true for PHI-like recipes that generate their own backedge
1490+ bool isPhiThatGeneratesBackedge () const override ;
14621491};
14631492
14641493// / VPWidenRecipe is a recipe for producing a widened instruction using the
0 commit comments