@@ -1190,23 +1190,18 @@ struct VPIRPhi : public VPIRInstruction {
11901190#endif
11911191};
11921192
1193- using MDArrayRef = ArrayRef<std::pair<unsigned , MDNode *>>;
1194-
11951193// / Helper to manage IR metadata for recipes. It filters out metadata that
11961194// / cannot be proagated.
11971195class VPIRMetadata {
11981196 SmallVector<std::pair<unsigned , MDNode *>> Metadata;
11991197
12001198protected:
1201- VPIRMetadata (MDArrayRef Metadata) : Metadata(Metadata ) {}
1199+ VPIRMetadata () {}
12021200 VPIRMetadata (Instruction &I) { getMetadataToPropagate (&I, Metadata); }
12031201
12041202public:
12051203 // / Add all metadata to \p I.
12061204 void applyMetadata (Instruction &I) const ;
1207-
1208- // / Return the IR metadata.
1209- MDArrayRef getMetadata () const { return Metadata; }
12101205};
12111206
12121207// / VPWidenRecipe is a recipe for producing a widened instruction using the
@@ -1219,21 +1214,19 @@ class VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
12191214protected:
12201215 template <typename IterT>
12211216 VPWidenRecipe (unsigned VPDefOpcode, Instruction &I,
1222- iterator_range<IterT> Operands, MDArrayRef Metadata )
1223- : VPRecipeWithIRFlags(VPDefOpcode, Operands, I), VPIRMetadata(Metadata ),
1217+ iterator_range<IterT> Operands)
1218+ : VPRecipeWithIRFlags(VPDefOpcode, Operands, I), VPIRMetadata(I ),
12241219 Opcode (I.getOpcode()) {}
12251220
12261221public:
12271222 template <typename IterT>
1228- VPWidenRecipe (Instruction &I, iterator_range<IterT> Operands,
1229- MDArrayRef Metadata)
1230- : VPWidenRecipe(VPDef::VPWidenSC, I, Operands, Metadata) {}
1223+ VPWidenRecipe (Instruction &I, iterator_range<IterT> Operands)
1224+ : VPWidenRecipe(VPDef::VPWidenSC, I, Operands) {}
12311225
12321226 ~VPWidenRecipe () override = default ;
12331227
12341228 VPWidenRecipe *clone () override {
1235- auto *R =
1236- new VPWidenRecipe (*getUnderlyingInstr (), operands (), getMetadata ());
1229+ auto *R = new VPWidenRecipe (*getUnderlyingInstr (), operands ());
12371230 R->transferFlags (*this );
12381231 return R;
12391232 }
@@ -1267,23 +1260,23 @@ class VPWidenCastRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
12671260
12681261public:
12691262 VPWidenCastRecipe (Instruction::CastOps Opcode, VPValue *Op, Type *ResultTy,
1270- CastInst &UI, MDArrayRef Metadata )
1271- : VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op, UI),
1272- VPIRMetadata (Metadata), Opcode(Opcode), ResultTy(ResultTy) {
1263+ CastInst &UI)
1264+ : VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op, UI), VPIRMetadata(UI),
1265+ Opcode (Opcode), ResultTy(ResultTy) {
12731266 assert (UI.getOpcode () == Opcode &&
12741267 " opcode of underlying cast doesn't match" );
12751268 }
12761269
12771270 VPWidenCastRecipe (Instruction::CastOps Opcode, VPValue *Op, Type *ResultTy)
1278- : VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op), VPIRMetadata({} ),
1271+ : VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op), VPIRMetadata(),
12791272 Opcode(Opcode), ResultTy(ResultTy) {}
12801273
12811274 ~VPWidenCastRecipe () override = default ;
12821275
12831276 VPWidenCastRecipe *clone () override {
12841277 if (auto *UV = getUnderlyingValue ())
12851278 return new VPWidenCastRecipe (Opcode, getOperand (0 ), ResultTy,
1286- *cast<CastInst>(UV), getMetadata () );
1279+ *cast<CastInst>(UV));
12871280
12881281 return new VPWidenCastRecipe (Opcode, getOperand (0 ), ResultTy);
12891282 }
@@ -1329,18 +1322,18 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
13291322public:
13301323 VPWidenIntrinsicRecipe (CallInst &CI, Intrinsic::ID VectorIntrinsicID,
13311324 ArrayRef<VPValue *> CallArguments, Type *Ty,
1332- MDArrayRef Metadata, DebugLoc DL = {})
1325+ DebugLoc DL = {})
13331326 : VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments, CI),
1334- VPIRMetadata (Metadata ), VectorIntrinsicID(VectorIntrinsicID),
1335- ResultTy(Ty), MayReadFromMemory(CI.mayReadFromMemory()),
1327+ VPIRMetadata (CI ), VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty ),
1328+ MayReadFromMemory(CI.mayReadFromMemory()),
13361329 MayWriteToMemory(CI.mayWriteToMemory()),
13371330 MayHaveSideEffects(CI.mayHaveSideEffects()) {}
13381331
13391332 VPWidenIntrinsicRecipe (Intrinsic::ID VectorIntrinsicID,
13401333 ArrayRef<VPValue *> CallArguments, Type *Ty,
13411334 DebugLoc DL = {})
13421335 : VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments, DL),
1343- VPIRMetadata({} ), VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty) {
1336+ VPIRMetadata(), VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty) {
13441337 LLVMContext &Ctx = Ty->getContext ();
13451338 AttributeSet Attrs = Intrinsic::getFnAttributes (Ctx, VectorIntrinsicID);
13461339 MemoryEffects ME = Attrs.getMemoryEffects ();
@@ -1356,7 +1349,7 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
13561349 VPWidenIntrinsicRecipe *clone () override {
13571350 return new VPWidenIntrinsicRecipe (*cast<CallInst>(getUnderlyingValue ()),
13581351 VectorIntrinsicID, {op_begin (), op_end ()},
1359- ResultTy, getMetadata (), getDebugLoc ());
1352+ ResultTy, getDebugLoc ());
13601353 }
13611354
13621355 VP_CLASSOF_IMPL (VPDef::VPWidenIntrinsicSC)
@@ -1404,11 +1397,10 @@ class VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
14041397
14051398public:
14061399 VPWidenCallRecipe (Value *UV, Function *Variant,
1407- ArrayRef<VPValue *> CallArguments, MDArrayRef Metadata,
1408- DebugLoc DL = {})
1400+ ArrayRef<VPValue *> CallArguments, DebugLoc DL = {})
14091401 : VPRecipeWithIRFlags(VPDef::VPWidenCallSC, CallArguments,
14101402 *cast<Instruction>(UV)),
1411- VPIRMetadata (Metadata ), Variant(Variant) {
1403+ VPIRMetadata (*cast<Instruction>(UV) ), Variant(Variant) {
14121404 assert (
14131405 isa<Function>(getOperand (getNumOperands () - 1 )->getLiveInIRValue ()) &&
14141406 " last operand must be the called function" );
@@ -1418,8 +1410,7 @@ class VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
14181410
14191411 VPWidenCallRecipe *clone () override {
14201412 return new VPWidenCallRecipe (getUnderlyingValue (), Variant,
1421- {op_begin (), op_end ()}, getMetadata (),
1422- getDebugLoc ());
1413+ {op_begin (), op_end ()}, getDebugLoc ());
14231414 }
14241415
14251416 VP_CLASSOF_IMPL (VPDef::VPWidenCallSC)
@@ -1497,16 +1488,15 @@ class VPHistogramRecipe : public VPRecipeBase {
14971488// / A recipe for widening select instructions.
14981489struct VPWidenSelectRecipe : public VPRecipeWithIRFlags , public VPIRMetadata {
14991490 template <typename IterT>
1500- VPWidenSelectRecipe (SelectInst &I, iterator_range<IterT> Operands,
1501- MDArrayRef Metadata)
1491+ VPWidenSelectRecipe (SelectInst &I, iterator_range<IterT> Operands)
15021492 : VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I),
1503- VPIRMetadata (Metadata ) {}
1493+ VPIRMetadata (I ) {}
15041494
15051495 ~VPWidenSelectRecipe () override = default ;
15061496
15071497 VPWidenSelectRecipe *clone () override {
15081498 return new VPWidenSelectRecipe (*cast<SelectInst>(getUnderlyingInstr ()),
1509- operands (), getMetadata () );
1499+ operands ());
15101500 }
15111501
15121502 VP_CLASSOF_IMPL (VPDef::VPWidenSelectSC)
@@ -2718,10 +2708,9 @@ struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
27182708 }
27192709
27202710 VPWidenLoadRecipe *clone () override {
2721- auto *Copy =
2722- new VPWidenLoadRecipe (cast<LoadInst>(Ingredient), getAddr (), getMask (),
2723- Consecutive, Reverse, getDebugLoc ());
2724- return Copy;
2711+ return new VPWidenLoadRecipe (cast<LoadInst>(Ingredient), getAddr (),
2712+ getMask (), Consecutive, Reverse,
2713+ getDebugLoc ());
27252714 }
27262715
27272716 VP_CLASSOF_IMPL (VPDef::VPWidenLoadSC);
@@ -2796,10 +2785,9 @@ struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
27962785 }
27972786
27982787 VPWidenStoreRecipe *clone () override {
2799- auto *Copy = new VPWidenStoreRecipe (cast<StoreInst>(Ingredient), getAddr (),
2800- getStoredValue (), getMask (),
2801- Consecutive, Reverse, getDebugLoc ());
2802- return Copy;
2788+ return new VPWidenStoreRecipe (cast<StoreInst>(Ingredient), getAddr (),
2789+ getStoredValue (), getMask (), Consecutive,
2790+ Reverse, getDebugLoc ());
28032791 }
28042792
28052793 VP_CLASSOF_IMPL (VPDef::VPWidenStoreSC);
0 commit comments