@@ -1120,7 +1120,7 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags,
11201120
11211121public:
11221122 VPInstruction (unsigned Opcode, ArrayRef<VPValue *> Operands,
1123- const VPIRFlags &Flags, const VPIRMetadata &MD = {},
1123+ const VPIRFlags &Flags = {} , const VPIRMetadata &MD = {},
11241124 DebugLoc DL = DebugLoc::getUnknown(), const Twine &Name = " " );
11251125
11261126 VP_CLASSOF_IMPL (VPDef::VPInstructionSC)
@@ -1210,14 +1210,10 @@ class VPInstructionWithType : public VPInstruction {
12101210
12111211public:
12121212 VPInstructionWithType (unsigned Opcode, ArrayRef<VPValue *> Operands,
1213- Type *ResultTy, const VPIRFlags &Flags, DebugLoc DL,
1213+ Type *ResultTy, const VPIRFlags &Flags = {},
1214+ const VPIRMetadata &Metadata = {},
1215+ DebugLoc DL = DebugLoc::getUnknown(),
12141216 const Twine &Name = " " )
1215- : VPInstruction(Opcode, Operands, Flags, {}, DL, Name),
1216- ResultTy (ResultTy) {}
1217-
1218- VPInstructionWithType (unsigned Opcode, ArrayRef<VPValue *> Operands,
1219- Type *ResultTy, DebugLoc DL, const VPIRFlags &Flags,
1220- const VPIRMetadata &Metadata, const Twine &Name = " " )
12211217 : VPInstruction(Opcode, Operands, Flags, Metadata, DL, Name),
12221218 ResultTy (ResultTy) {}
12231219
@@ -1246,7 +1242,7 @@ class VPInstructionWithType : public VPInstruction {
12461242 VPInstruction *clone () override {
12471243 auto *New =
12481244 new VPInstructionWithType (getOpcode (), operands (), getResultType (),
1249- *this , getDebugLoc (), getName ());
1245+ *this , * this , getDebugLoc (), getName ());
12501246 New->setUnderlyingValue (getUnderlyingValue ());
12511247 return New;
12521248 }
@@ -1330,7 +1326,7 @@ class VPPhiAccessors {
13301326
13311327struct LLVM_ABI_FOR_TEST VPPhi : public VPInstruction, public VPPhiAccessors {
13321328 VPPhi (ArrayRef<VPValue *> Operands, DebugLoc DL, const Twine &Name = " " )
1333- : VPInstruction(Instruction::PHI, Operands, {}, DL, Name) {}
1329+ : VPInstruction(Instruction::PHI, Operands, {}, {}, DL, Name) {}
13341330
13351331 static inline bool classof (const VPUser *U) {
13361332 auto *VPI = dyn_cast<VPInstruction>(U);
@@ -1476,10 +1472,8 @@ class LLVM_ABI_FOR_TEST VPWidenRecipe : public VPRecipeWithIRFlags,
14761472
14771473 VPWidenRecipe (Instruction &I, ArrayRef<VPValue *> Operands,
14781474 const VPIRMetadata &Metadata, DebugLoc DL)
1479- : VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, VPIRFlags(I), DL),
1480- VPIRMetadata(Metadata), Opcode(I.getOpcode()) {
1481- setUnderlyingValue (&I);
1482- }
1475+ : VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, I),
1476+ VPIRMetadata(Metadata), Opcode(I.getOpcode()) {}
14831477
14841478 ~VPWidenRecipe () override = default ;
14851479
@@ -1520,26 +1514,30 @@ class VPWidenCastRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15201514
15211515public:
15221516 VPWidenCastRecipe (Instruction::CastOps Opcode, VPValue *Op, Type *ResultTy,
1523- CastInst *UI = nullptr , const VPIRFlags &Flags = {},
1517+ CastInst &UI, const VPIRMetadata &Metadata)
1518+ : VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op, UI),
1519+ VPIRMetadata (Metadata), Opcode(Opcode), ResultTy(ResultTy) {
1520+ assert (UI.getOpcode () == Opcode &&
1521+ " opcode of underlying cast doesn't match" );
1522+ }
1523+ VPWidenCastRecipe (Instruction::CastOps Opcode, VPValue *Op, Type *ResultTy,
1524+ const VPIRFlags &Flags = {},
15241525 const VPIRMetadata &Metadata = {},
15251526 DebugLoc DL = DebugLoc::getUnknown())
1526- : VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op,
1527- UI ? VPIRFlags(*UI) : Flags,
1528- UI ? UI->getDebugLoc () : DL),
1527+ : VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op, Flags, DL),
15291528 VPIRMetadata(Metadata), Opcode(Opcode), ResultTy(ResultTy) {
15301529 assert (flagsValidForOpcode (Opcode) &&
15311530 " Set flags not supported for the provided opcode" );
1532- assert ((!UI || UI->getOpcode () == Opcode) &&
1533- " opcode of underlying cast doesn't match" );
1534- setUnderlyingValue (UI);
15351531 }
15361532
15371533 ~VPWidenCastRecipe () override = default ;
15381534
15391535 VPWidenCastRecipe *clone () override {
1540- return new VPWidenCastRecipe (Opcode, getOperand (0 ), ResultTy,
1541- cast_or_null<CastInst>(getUnderlyingValue ()),
1542- *this , *this , getDebugLoc ());
1536+ auto *New = new VPWidenCastRecipe (Opcode, getOperand (0 ), ResultTy, *this ,
1537+ *this , getDebugLoc ());
1538+ if (auto *UV = getUnderlyingValue ())
1539+ New->setUnderlyingValue (UV);
1540+ return New;
15431541 }
15441542
15451543 VP_CLASSOF_IMPL (VPDef::VPWidenCastSC)
@@ -1594,9 +1592,13 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15941592
15951593 VPWidenIntrinsicRecipe (Intrinsic::ID VectorIntrinsicID,
15961594 ArrayRef<VPValue *> CallArguments, Type *Ty,
1595+ const VPIRFlags &Flags = {},
1596+ const VPIRMetadata &Metadata = {},
15971597 DebugLoc DL = DebugLoc::getUnknown())
1598- : VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments, DL),
1599- VPIRMetadata(), VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty) {
1598+ : VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments, Flags,
1599+ DL),
1600+ VPIRMetadata(Metadata), VectorIntrinsicID(VectorIntrinsicID),
1601+ ResultTy(Ty) {
16001602 LLVMContext &Ctx = Ty->getContext ();
16011603 AttributeSet Attrs = Intrinsic::getFnAttributes (Ctx, VectorIntrinsicID);
16021604 MemoryEffects ME = Attrs.getMemoryEffects ();
@@ -1615,7 +1617,7 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
16151617 operands (), ResultTy, *this ,
16161618 getDebugLoc ());
16171619 return new VPWidenIntrinsicRecipe (VectorIntrinsicID, operands (), ResultTy,
1618- getDebugLoc ());
1620+ * this , * this , getDebugLoc ());
16191621 }
16201622
16211623 VP_CLASSOF_IMPL (VPDef::VPWidenIntrinsicSC)
@@ -1756,15 +1758,16 @@ class VPHistogramRecipe : public VPRecipeBase {
17561758// / instruction.
17571759struct LLVM_ABI_FOR_TEST VPWidenSelectRecipe : public VPRecipeWithIRFlags,
17581760 public VPIRMetadata {
1759- VPWidenSelectRecipe (SelectInst &I, ArrayRef<VPValue *> Operands)
1761+ VPWidenSelectRecipe (SelectInst &I, ArrayRef<VPValue *> Operands,
1762+ VPIRMetadata &MD)
17601763 : VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I),
1761- VPIRMetadata (I ) {}
1764+ VPIRMetadata (MD ) {}
17621765
17631766 ~VPWidenSelectRecipe () override = default ;
17641767
17651768 VPWidenSelectRecipe *clone () override {
17661769 return new VPWidenSelectRecipe (*cast<SelectInst>(getUnderlyingInstr ()),
1767- operands ());
1770+ operands (), * this );
17681771 }
17691772
17701773 VP_CLASSOF_IMPL (VPDef::VPWidenSelectSC)
0 commit comments