@@ -1104,7 +1104,7 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags,
11041104
11051105public:
11061106 VPInstruction (unsigned Opcode, ArrayRef<VPValue *> Operands,
1107- const VPIRFlags &Flags, const VPIRMetadata &MD = {},
1107+ const VPIRFlags &Flags = {} , const VPIRMetadata &MD = {},
11081108 DebugLoc DL = DebugLoc::getUnknown(), const Twine &Name = " " );
11091109
11101110 VP_CLASSOF_IMPL (VPDef::VPInstructionSC)
@@ -1191,14 +1191,10 @@ class VPInstructionWithType : public VPInstruction {
11911191
11921192public:
11931193 VPInstructionWithType (unsigned Opcode, ArrayRef<VPValue *> Operands,
1194- Type *ResultTy, const VPIRFlags &Flags, DebugLoc DL,
1194+ Type *ResultTy, const VPIRFlags &Flags = {},
1195+ const VPIRMetadata &Metadata = {},
1196+ DebugLoc DL = DebugLoc::getUnknown(),
11951197 const Twine &Name = " " )
1196- : VPInstruction(Opcode, Operands, Flags, {}, DL, Name),
1197- ResultTy (ResultTy) {}
1198-
1199- VPInstructionWithType (unsigned Opcode, ArrayRef<VPValue *> Operands,
1200- Type *ResultTy, DebugLoc DL, const VPIRFlags &Flags,
1201- const VPIRMetadata &Metadata, const Twine &Name = " " )
12021198 : VPInstruction(Opcode, Operands, Flags, Metadata, DL, Name),
12031199 ResultTy (ResultTy) {}
12041200
@@ -1227,7 +1223,7 @@ class VPInstructionWithType : public VPInstruction {
12271223 VPInstruction *clone () override {
12281224 auto *New =
12291225 new VPInstructionWithType (getOpcode (), operands (), getResultType (),
1230- *this , getDebugLoc (), getName ());
1226+ *this , * this , getDebugLoc (), getName ());
12311227 New->setUnderlyingValue (getUnderlyingValue ());
12321228 return New;
12331229 }
@@ -1310,7 +1306,7 @@ class VPPhiAccessors {
13101306
13111307struct LLVM_ABI_FOR_TEST VPPhi : public VPInstruction, public VPPhiAccessors {
13121308 VPPhi (ArrayRef<VPValue *> Operands, DebugLoc DL, const Twine &Name = " " )
1313- : VPInstruction(Instruction::PHI, Operands, {}, DL, Name) {}
1309+ : VPInstruction(Instruction::PHI, Operands, {}, {}, DL, Name) {}
13141310
13151311 static inline bool classof (const VPUser *U) {
13161312 auto *VPI = dyn_cast<VPInstruction>(U);
@@ -1455,10 +1451,8 @@ class LLVM_ABI_FOR_TEST VPWidenRecipe : public VPRecipeWithIRFlags,
14551451
14561452 VPWidenRecipe (Instruction &I, ArrayRef<VPValue *> Operands,
14571453 const VPIRMetadata &Metadata, DebugLoc DL)
1458- : VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, VPIRFlags(I), DL),
1459- VPIRMetadata(Metadata), Opcode(I.getOpcode()) {
1460- setUnderlyingValue (&I);
1461- }
1454+ : VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, I),
1455+ VPIRMetadata(Metadata), Opcode(I.getOpcode()) {}
14621456
14631457 ~VPWidenRecipe () override = default ;
14641458
@@ -1498,26 +1492,30 @@ class VPWidenCastRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
14981492
14991493public:
15001494 VPWidenCastRecipe (Instruction::CastOps Opcode, VPValue *Op, Type *ResultTy,
1501- CastInst *UI = nullptr , const VPIRFlags &Flags = {},
1495+ CastInst &UI, const VPIRMetadata &Metadata)
1496+ : VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op, UI),
1497+ VPIRMetadata (Metadata), Opcode(Opcode), ResultTy(ResultTy) {
1498+ assert (UI.getOpcode () == Opcode &&
1499+ " opcode of underlying cast doesn't match" );
1500+ }
1501+ VPWidenCastRecipe (Instruction::CastOps Opcode, VPValue *Op, Type *ResultTy,
1502+ const VPIRFlags &Flags = {},
15021503 const VPIRMetadata &Metadata = {},
15031504 DebugLoc DL = DebugLoc::getUnknown())
1504- : VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op,
1505- UI ? VPIRFlags(*UI) : Flags,
1506- UI ? UI->getDebugLoc () : DL),
1505+ : VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op, Flags, DL),
15071506 VPIRMetadata(Metadata), Opcode(Opcode), ResultTy(ResultTy) {
15081507 assert (flagsValidForOpcode (Opcode) &&
15091508 " Set flags not supported for the provided opcode" );
1510- assert ((!UI || UI->getOpcode () == Opcode) &&
1511- " opcode of underlying cast doesn't match" );
1512- setUnderlyingValue (UI);
15131509 }
15141510
15151511 ~VPWidenCastRecipe () override = default ;
15161512
15171513 VPWidenCastRecipe *clone () override {
1518- return new VPWidenCastRecipe (Opcode, getOperand (0 ), ResultTy,
1519- cast_or_null<CastInst>(getUnderlyingValue ()),
1520- *this , *this , getDebugLoc ());
1514+ auto *New = new VPWidenCastRecipe (Opcode, getOperand (0 ), ResultTy, *this ,
1515+ *this , getDebugLoc ());
1516+ if (auto *UV = getUnderlyingValue ())
1517+ New->setUnderlyingValue (UV);
1518+ return New;
15211519 }
15221520
15231521 VP_CLASSOF_IMPL (VPDef::VPWidenCastSC)
@@ -1571,9 +1569,13 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15711569
15721570 VPWidenIntrinsicRecipe (Intrinsic::ID VectorIntrinsicID,
15731571 ArrayRef<VPValue *> CallArguments, Type *Ty,
1572+ const VPIRFlags &Flags = {},
1573+ const VPIRMetadata &Metadata = {},
15741574 DebugLoc DL = DebugLoc::getUnknown())
1575- : VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments, DL),
1576- VPIRMetadata(), VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty) {
1575+ : VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments, Flags,
1576+ DL),
1577+ VPIRMetadata(Metadata), VectorIntrinsicID(VectorIntrinsicID),
1578+ ResultTy(Ty) {
15771579 LLVMContext &Ctx = Ty->getContext ();
15781580 AttributeSet Attrs = Intrinsic::getFnAttributes (Ctx, VectorIntrinsicID);
15791581 MemoryEffects ME = Attrs.getMemoryEffects ();
@@ -1592,7 +1594,7 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15921594 operands (), ResultTy, *this ,
15931595 getDebugLoc ());
15941596 return new VPWidenIntrinsicRecipe (VectorIntrinsicID, operands (), ResultTy,
1595- getDebugLoc ());
1597+ * this , * this , getDebugLoc ());
15961598 }
15971599
15981600 VP_CLASSOF_IMPL (VPDef::VPWidenIntrinsicSC)
@@ -1730,15 +1732,16 @@ class VPHistogramRecipe : public VPRecipeBase {
17301732// / instruction.
17311733struct LLVM_ABI_FOR_TEST VPWidenSelectRecipe : public VPRecipeWithIRFlags,
17321734 public VPIRMetadata {
1733- VPWidenSelectRecipe (SelectInst &I, ArrayRef<VPValue *> Operands)
1735+ VPWidenSelectRecipe (SelectInst &I, ArrayRef<VPValue *> Operands,
1736+ VPIRMetadata &MD)
17341737 : VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I),
1735- VPIRMetadata (I ) {}
1738+ VPIRMetadata (MD ) {}
17361739
17371740 ~VPWidenSelectRecipe () override = default ;
17381741
17391742 VPWidenSelectRecipe *clone () override {
17401743 return new VPWidenSelectRecipe (*cast<SelectInst>(getUnderlyingInstr ()),
1741- operands ());
1744+ operands (), * this );
17421745 }
17431746
17441747 VP_CLASSOF_IMPL (VPDef::VPWidenSelectSC)
0 commit comments