@@ -890,10 +890,29 @@ class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
890
890
bool mayHaveSideEffects () const ;
891
891
892
892
// / 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" );
894
896
return getVPDefID () >= VPFirstPHISC && getVPDefID () <= VPLastPHISC;
895
897
}
896
898
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
+
897
916
// / Returns true if the recipe may read from memory.
898
917
bool mayReadFromMemory () const ;
899
918
@@ -1459,6 +1478,16 @@ class VPInstruction : public VPRecipeWithIRFlags {
1459
1478
// / Returns true if this VPInstruction's operands are single scalars and the
1460
1479
// / result is also a single scalar.
1461
1480
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 ;
1462
1491
};
1463
1492
1464
1493
// / VPWidenRecipe is a recipe for producing a widened instruction using the
0 commit comments