@@ -709,13 +709,18 @@ class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
709
709
// / Each VPRecipe belongs to a single VPBasicBlock.
710
710
VPBasicBlock *Parent = nullptr ;
711
711
712
+ // / The debug location for the recipe.
713
+ DebugLoc DL;
714
+
712
715
public:
713
- VPRecipeBase (const unsigned char SC, ArrayRef<VPValue *> Operands)
714
- : VPDef(SC), VPUser(Operands, VPUser::VPUserID::Recipe) {}
716
+ VPRecipeBase (const unsigned char SC, ArrayRef<VPValue *> Operands,
717
+ DebugLoc DL = {})
718
+ : VPDef(SC), VPUser(Operands, VPUser::VPUserID::Recipe), DL(DL) {}
715
719
716
720
template <typename IterT>
717
- VPRecipeBase (const unsigned char SC, iterator_range<IterT> Operands)
718
- : VPDef(SC), VPUser(Operands, VPUser::VPUserID::Recipe) {}
721
+ VPRecipeBase (const unsigned char SC, iterator_range<IterT> Operands,
722
+ DebugLoc DL = {})
723
+ : VPDef(SC), VPUser(Operands, VPUser::VPUserID::Recipe), DL(DL) {}
719
724
virtual ~VPRecipeBase () = default ;
720
725
721
726
// / \return the VPBasicBlock which this VPRecipe belongs to.
@@ -792,6 +797,9 @@ class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
792
797
bool mayReadOrWriteMemory () const {
793
798
return mayReadFromMemory () || mayWriteToMemory ();
794
799
}
800
+
801
+ // / Returns the debug location of the recipe.
802
+ DebugLoc getDebugLoc () const { return DL; }
795
803
};
796
804
797
805
// Helper macro to define common classof implementations for recipes.
@@ -862,15 +870,15 @@ class VPRecipeWithIRFlags : public VPRecipeBase {
862
870
863
871
public:
864
872
template <typename IterT>
865
- VPRecipeWithIRFlags (const unsigned char SC, IterT Operands)
866
- : VPRecipeBase(SC, Operands) {
873
+ VPRecipeWithIRFlags (const unsigned char SC, IterT Operands, DebugLoc DL = {} )
874
+ : VPRecipeBase(SC, Operands, DL ) {
867
875
OpType = OperationType::Other;
868
876
AllFlags = 0 ;
869
877
}
870
878
871
879
template <typename IterT>
872
880
VPRecipeWithIRFlags (const unsigned char SC, IterT Operands, Instruction &I)
873
- : VPRecipeWithIRFlags(SC, Operands) {
881
+ : VPRecipeWithIRFlags(SC, Operands, I.getDebugLoc() ) {
874
882
if (auto *Op = dyn_cast<CmpInst>(&I)) {
875
883
OpType = OperationType::Cmp;
876
884
CmpPredicate = Op->getPredicate ();
@@ -891,20 +899,20 @@ class VPRecipeWithIRFlags : public VPRecipeBase {
891
899
892
900
template <typename IterT>
893
901
VPRecipeWithIRFlags (const unsigned char SC, IterT Operands,
894
- CmpInst::Predicate Pred)
895
- : VPRecipeBase(SC, Operands), OpType(OperationType::Cmp),
902
+ CmpInst::Predicate Pred, DebugLoc DL = {} )
903
+ : VPRecipeBase(SC, Operands, DL ), OpType(OperationType::Cmp),
896
904
CmpPredicate (Pred) {}
897
905
898
906
template <typename IterT>
899
907
VPRecipeWithIRFlags (const unsigned char SC, IterT Operands,
900
- WrapFlagsTy WrapFlags)
901
- : VPRecipeBase(SC, Operands), OpType(OperationType::OverflowingBinOp),
908
+ WrapFlagsTy WrapFlags, DebugLoc DL = {} )
909
+ : VPRecipeBase(SC, Operands, DL ), OpType(OperationType::OverflowingBinOp),
902
910
WrapFlags(WrapFlags) {}
903
911
904
912
template <typename IterT>
905
913
VPRecipeWithIRFlags (const unsigned char SC, IterT Operands,
906
- FastMathFlags FMFs)
907
- : VPRecipeBase(SC, Operands), OpType(OperationType::FPMathOp),
914
+ FastMathFlags FMFs, DebugLoc DL = {} )
915
+ : VPRecipeBase(SC, Operands, DL ), OpType(OperationType::FPMathOp),
908
916
FMFs(FMFs) {}
909
917
910
918
static inline bool classof (const VPRecipeBase *R) {
@@ -1030,7 +1038,6 @@ class VPInstruction : public VPRecipeWithIRFlags, public VPValue {
1030
1038
private:
1031
1039
typedef unsigned char OpcodeTy;
1032
1040
OpcodeTy Opcode;
1033
- DebugLoc DL;
1034
1041
1035
1042
// / An optional name that can be used for the generated IR instruction.
1036
1043
const std::string Name;
@@ -1053,8 +1060,8 @@ class VPInstruction : public VPRecipeWithIRFlags, public VPValue {
1053
1060
public:
1054
1061
VPInstruction (unsigned Opcode, ArrayRef<VPValue *> Operands, DebugLoc DL,
1055
1062
const Twine &Name = " " )
1056
- : VPRecipeWithIRFlags(VPDef::VPInstructionSC, Operands), VPValue( this ),
1057
- Opcode (Opcode ), DL(DL ), Name(Name.str()) {}
1063
+ : VPRecipeWithIRFlags(VPDef::VPInstructionSC, Operands, DL ),
1064
+ VPValue ( this ), Opcode(Opcode ), Name(Name.str()) {}
1058
1065
1059
1066
VPInstruction (unsigned Opcode, std::initializer_list<VPValue *> Operands,
1060
1067
DebugLoc DL = {}, const Twine &Name = " " )
@@ -1065,8 +1072,8 @@ class VPInstruction : public VPRecipeWithIRFlags, public VPValue {
1065
1072
1066
1073
VPInstruction (unsigned Opcode, std::initializer_list<VPValue *> Operands,
1067
1074
WrapFlagsTy WrapFlags, DebugLoc DL = {}, const Twine &Name = " " )
1068
- : VPRecipeWithIRFlags(VPDef::VPInstructionSC, Operands, WrapFlags),
1069
- VPValue(this ), Opcode(Opcode), DL(DL), Name(Name.str()) {}
1075
+ : VPRecipeWithIRFlags(VPDef::VPInstructionSC, Operands, WrapFlags, DL ),
1076
+ VPValue(this ), Opcode(Opcode), Name(Name.str()) {}
1070
1077
1071
1078
VPInstruction (unsigned Opcode, std::initializer_list<VPValue *> Operands,
1072
1079
FastMathFlags FMFs, DebugLoc DL = {}, const Twine &Name = " " );
@@ -1238,7 +1245,8 @@ class VPWidenCallRecipe : public VPRecipeBase, public VPValue {
1238
1245
struct VPWidenSelectRecipe : public VPRecipeBase , public VPValue {
1239
1246
template <typename IterT>
1240
1247
VPWidenSelectRecipe (SelectInst &I, iterator_range<IterT> Operands)
1241
- : VPRecipeBase(VPDef::VPWidenSelectSC, Operands), VPValue(this , &I) {}
1248
+ : VPRecipeBase(VPDef::VPWidenSelectSC, Operands, I.getDebugLoc()),
1249
+ VPValue (this , &I) {}
1242
1250
1243
1251
~VPWidenSelectRecipe () override = default ;
1244
1252
@@ -1324,8 +1332,8 @@ class VPWidenGEPRecipe : public VPRecipeWithIRFlags, public VPValue {
1324
1332
class VPHeaderPHIRecipe : public VPRecipeBase , public VPValue {
1325
1333
protected:
1326
1334
VPHeaderPHIRecipe (unsigned char VPDefID, Instruction *UnderlyingInstr,
1327
- VPValue *Start = nullptr )
1328
- : VPRecipeBase(VPDefID, {}), VPValue(this , UnderlyingInstr) {
1335
+ VPValue *Start = nullptr , DebugLoc DL = {} )
1336
+ : VPRecipeBase(VPDefID, {}, DL ), VPValue(this , UnderlyingInstr) {
1329
1337
if (Start)
1330
1338
addOperand (Start);
1331
1339
}
@@ -1607,14 +1615,13 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe {
1607
1615
// / A recipe for vectorizing a phi-node as a sequence of mask-based select
1608
1616
// / instructions.
1609
1617
class VPBlendRecipe : public VPRecipeBase , public VPValue {
1610
- PHINode *Phi;
1611
-
1612
1618
public:
1613
1619
// / The blend operation is a User of the incoming values and of their
1614
1620
// / respective masks, ordered [I0, M0, I1, M1, ...]. Note that a single value
1615
1621
// / might be incoming with a full mask for which there is no VPValue.
1616
1622
VPBlendRecipe (PHINode *Phi, ArrayRef<VPValue *> Operands)
1617
- : VPRecipeBase(VPDef::VPBlendSC, Operands), VPValue(this , Phi), Phi(Phi) {
1623
+ : VPRecipeBase(VPDef::VPBlendSC, Operands, Phi->getDebugLoc ()),
1624
+ VPValue(this , Phi) {
1618
1625
assert (Operands.size () > 0 &&
1619
1626
((Operands.size () == 1 ) || (Operands.size () % 2 == 0 )) &&
1620
1627
" Expected either a single incoming value or a positive even number "
@@ -2047,11 +2054,9 @@ class VPExpandSCEVRecipe : public VPRecipeBase, public VPValue {
2047
2054
// / loop). VPWidenCanonicalIVRecipe represents the vector version of the
2048
2055
// / canonical induction variable.
2049
2056
class VPCanonicalIVPHIRecipe : public VPHeaderPHIRecipe {
2050
- DebugLoc DL;
2051
-
2052
2057
public:
2053
2058
VPCanonicalIVPHIRecipe (VPValue *StartV, DebugLoc DL)
2054
- : VPHeaderPHIRecipe(VPDef::VPCanonicalIVPHISC, nullptr , StartV), DL( DL) {}
2059
+ : VPHeaderPHIRecipe(VPDef::VPCanonicalIVPHISC, nullptr , StartV, DL) {}
2055
2060
2056
2061
~VPCanonicalIVPHIRecipe () override = default ;
2057
2062
@@ -2094,12 +2099,10 @@ class VPCanonicalIVPHIRecipe : public VPHeaderPHIRecipe {
2094
2099
// / TODO: It would be good to use the existing VPWidenPHIRecipe instead and
2095
2100
// / remove VPActiveLaneMaskPHIRecipe.
2096
2101
class VPActiveLaneMaskPHIRecipe : public VPHeaderPHIRecipe {
2097
- DebugLoc DL;
2098
-
2099
2102
public:
2100
2103
VPActiveLaneMaskPHIRecipe (VPValue *StartMask, DebugLoc DL)
2101
- : VPHeaderPHIRecipe(VPDef::VPActiveLaneMaskPHISC, nullptr , StartMask) ,
2102
- DL ( DL) {}
2104
+ : VPHeaderPHIRecipe(VPDef::VPActiveLaneMaskPHISC, nullptr , StartMask,
2105
+ DL) {}
2103
2106
2104
2107
~VPActiveLaneMaskPHIRecipe () override = default ;
2105
2108
0 commit comments