@@ -1199,10 +1199,11 @@ class VPIRMetadata {
11991199
12001200protected:
12011201 VPIRMetadata (MDArrayRef Metadata) : Metadata(Metadata) {}
1202+ VPIRMetadata (Instruction &I) { getMetadataToPropagate (&I, Metadata); }
12021203
12031204public:
1204- // / Add all metadata to \p V if it is an instruction .
1205- void applyMetadata (Value *V ) const ;
1205+ // / Add all metadata to \p I .
1206+ void applyMetadata (Instruction &I ) const ;
12061207
12071208 // / Return the IR metadata.
12081209 MDArrayRef getMetadata () const { return Metadata; }
@@ -1337,10 +1338,9 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
13371338
13381339 VPWidenIntrinsicRecipe (Intrinsic::ID VectorIntrinsicID,
13391340 ArrayRef<VPValue *> CallArguments, Type *Ty,
1340- MDArrayRef Metadata, DebugLoc DL = {})
1341+ DebugLoc DL = {})
13411342 : VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments, DL),
1342- VPIRMetadata(Metadata), VectorIntrinsicID(VectorIntrinsicID),
1343- ResultTy(Ty) {
1343+ VPIRMetadata({}), VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty) {
13441344 LLVMContext &Ctx = Ty->getContext ();
13451345 AttributeSet Attrs = Intrinsic::getFnAttributes (Ctx, VectorIntrinsicID);
13461346 MemoryEffects ME = Attrs.getMemoryEffects ();
@@ -2651,9 +2651,8 @@ class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
26512651
26522652 VPWidenMemoryRecipe (const char unsigned SC, Instruction &I,
26532653 std::initializer_list<VPValue *> Operands,
2654- bool Consecutive, bool Reverse, MDArrayRef Metadata,
2655- DebugLoc DL)
2656- : VPRecipeBase(SC, Operands, DL), VPIRMetadata(Metadata), Ingredient(I),
2654+ bool Consecutive, bool Reverse, DebugLoc DL)
2655+ : VPRecipeBase(SC, Operands, DL), VPIRMetadata(I), Ingredient(I),
26572656 Consecutive (Consecutive), Reverse(Reverse) {
26582657 assert ((Consecutive || !Reverse) && " Reverse implies consecutive" );
26592658 }
@@ -2711,18 +2710,17 @@ class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
27112710// / optional mask.
27122711struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
27132712 VPWidenLoadRecipe (LoadInst &Load, VPValue *Addr, VPValue *Mask,
2714- bool Consecutive, bool Reverse, MDArrayRef Metadata,
2715- DebugLoc DL)
2713+ bool Consecutive, bool Reverse, DebugLoc DL)
27162714 : VPWidenMemoryRecipe(VPDef::VPWidenLoadSC, Load, {Addr}, Consecutive,
2717- Reverse, Metadata, DL),
2715+ Reverse, DL),
27182716 VPValue (this , &Load) {
27192717 setMask (Mask);
27202718 }
27212719
27222720 VPWidenLoadRecipe *clone () override {
2723- auto *Copy = new VPWidenLoadRecipe (cast<LoadInst>(Ingredient), getAddr (),
2724- getMask ( ), Consecutive, Reverse ,
2725- getMetadata () , getDebugLoc ());
2721+ auto *Copy =
2722+ new VPWidenLoadRecipe (cast<LoadInst>(Ingredient ), getAddr (), getMask () ,
2723+ Consecutive, Reverse , getDebugLoc ());
27262724 return Copy;
27272725 }
27282726
@@ -2754,7 +2752,7 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
27542752 VPWidenLoadEVLRecipe (VPWidenLoadRecipe &L, VPValue &EVL, VPValue *Mask)
27552753 : VPWidenMemoryRecipe(VPDef::VPWidenLoadEVLSC, L.getIngredient(),
27562754 {L.getAddr (), &EVL}, L.isConsecutive(),
2757- L.isReverse(), L.getMetadata(), L. getDebugLoc()),
2755+ L.isReverse(), L.getDebugLoc()),
27582756 VPValue (this , &getIngredient ()) {
27592757 setMask (Mask);
27602758 }
@@ -2791,17 +2789,16 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
27912789// / to store to and an optional mask.
27922790struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
27932791 VPWidenStoreRecipe (StoreInst &Store, VPValue *Addr, VPValue *StoredVal,
2794- VPValue *Mask, bool Consecutive, bool Reverse,
2795- MDArrayRef Metadata, DebugLoc DL)
2792+ VPValue *Mask, bool Consecutive, bool Reverse, DebugLoc DL)
27962793 : VPWidenMemoryRecipe(VPDef::VPWidenStoreSC, Store, {Addr, StoredVal},
2797- Consecutive, Reverse, Metadata, DL) {
2794+ Consecutive, Reverse, DL) {
27982795 setMask (Mask);
27992796 }
28002797
28012798 VPWidenStoreRecipe *clone () override {
2802- auto *Copy = new VPWidenStoreRecipe (
2803- cast<StoreInst>(Ingredient), getAddr (), getStoredValue (), getMask (),
2804- Consecutive, Reverse, getMetadata () , getDebugLoc ());
2799+ auto *Copy = new VPWidenStoreRecipe (cast<StoreInst>(Ingredient), getAddr (),
2800+ getStoredValue (), getMask (),
2801+ Consecutive, Reverse, getDebugLoc ());
28052802 return Copy;
28062803 }
28072804
@@ -2836,8 +2833,7 @@ struct VPWidenStoreEVLRecipe final : public VPWidenMemoryRecipe {
28362833 VPWidenStoreEVLRecipe (VPWidenStoreRecipe &S, VPValue &EVL, VPValue *Mask)
28372834 : VPWidenMemoryRecipe(VPDef::VPWidenStoreEVLSC, S.getIngredient(),
28382835 {S.getAddr (), S.getStoredValue (), &EVL},
2839- S.isConsecutive(), S.isReverse(), S.getMetadata(),
2840- S.getDebugLoc()) {
2836+ S.isConsecutive(), S.isReverse(), S.getDebugLoc()) {
28412837 setMask (Mask);
28422838 }
28432839
0 commit comments