@@ -1194,24 +1194,22 @@ struct VPIRPhi : public VPIRInstruction {
1194
1194
#endif
1195
1195
};
1196
1196
1197
- using MDArrayRef = ArrayRef<std::pair<unsigned , MDNode *>>;
1198
-
1199
1197
// / Helper to manage IR metadata for recipes. It filters out metadata that
1200
1198
// / cannot be propagated.
1201
1199
class VPIRMetadata {
1202
1200
SmallVector<std::pair<unsigned , MDNode *>> Metadata;
1203
1201
1204
1202
protected:
1205
- VPIRMetadata () {}
1206
1203
VPIRMetadata (Instruction &I) { getMetadataToPropagate (&I, Metadata); }
1207
- VPIRMetadata (MDArrayRef Metadata) : Metadata(Metadata) {}
1208
1204
1209
1205
public:
1206
+ VPIRMetadata () {}
1207
+ VPIRMetadata (ArrayRef<std::pair<unsigned , MDNode *>> Metadata)
1208
+ : Metadata(Metadata) {}
1209
+ VPIRMetadata (const VPIRMetadata &Other) : Metadata(Other.Metadata) {}
1210
+
1210
1211
// / Add all metadata to \p I.
1211
1212
void applyMetadata (Instruction &I) const ;
1212
-
1213
- // / Return the IR metadata.
1214
- MDArrayRef getMetadata () const { return Metadata; }
1215
1213
};
1216
1214
1217
1215
// / VPWidenRecipe is a recipe for producing a widened instruction using the
@@ -2482,7 +2480,8 @@ class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
2482
2480
2483
2481
public:
2484
2482
VPReplicateRecipe (Instruction *I, ArrayRef<VPValue *> Operands,
2485
- bool IsUniform, VPValue *Mask = nullptr , ArrayRef<std::pair<unsigned , MDNode *>> Metadata = {})
2483
+ bool IsUniform, VPValue *Mask = nullptr ,
2484
+ VPIRMetadata Metadata = {})
2486
2485
: VPRecipeWithIRFlags(VPDef::VPReplicateSC, Operands, *I),
2487
2486
VPIRMetadata (Metadata), IsUniform(IsUniform), IsPredicated(Mask) {
2488
2487
if (Mask)
@@ -2492,9 +2491,9 @@ class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
2492
2491
~VPReplicateRecipe () override = default ;
2493
2492
2494
2493
VPReplicateRecipe *clone () override {
2495
- auto *Copy = new VPReplicateRecipe (
2496
- getUnderlyingInstr (), operands (), IsUniform,
2497
- isPredicated () ? getMask () : nullptr , getMetadata () );
2494
+ auto *Copy =
2495
+ new VPReplicateRecipe ( getUnderlyingInstr (), operands (), IsUniform,
2496
+ isPredicated () ? getMask () : nullptr , * this );
2498
2497
Copy->transferFlags (*this );
2499
2498
return Copy;
2500
2499
}
@@ -2654,8 +2653,8 @@ class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
2654
2653
2655
2654
VPWidenMemoryRecipe (const char unsigned SC, Instruction &I,
2656
2655
std::initializer_list<VPValue *> Operands,
2657
- bool Consecutive, bool Reverse, MDArrayRef Metadata,
2658
- DebugLoc DL)
2656
+ bool Consecutive, bool Reverse,
2657
+ const VPIRMetadata &Metadata, DebugLoc DL)
2659
2658
: VPRecipeBase(SC, Operands, DL), VPIRMetadata(Metadata), Ingredient(I),
2660
2659
Consecutive (Consecutive), Reverse(Reverse) {
2661
2660
assert ((Consecutive || !Reverse) && " Reverse implies consecutive" );
@@ -2714,8 +2713,8 @@ class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
2714
2713
// / optional mask.
2715
2714
struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
2716
2715
VPWidenLoadRecipe (LoadInst &Load, VPValue *Addr, VPValue *Mask,
2717
- bool Consecutive, bool Reverse, MDArrayRef Metadata,
2718
- DebugLoc DL)
2716
+ bool Consecutive, bool Reverse,
2717
+ const VPIRMetadata &Metadata, DebugLoc DL)
2719
2718
: VPWidenMemoryRecipe(VPDef::VPWidenLoadSC, Load, {Addr}, Consecutive,
2720
2719
Reverse, Metadata, DL),
2721
2720
VPValue (this , &Load) {
@@ -2724,7 +2723,7 @@ struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
2724
2723
2725
2724
VPWidenLoadRecipe *clone () override {
2726
2725
return new VPWidenLoadRecipe (cast<LoadInst>(Ingredient), getAddr (),
2727
- getMask (), Consecutive, Reverse, getMetadata () ,
2726
+ getMask (), Consecutive, Reverse, * this ,
2728
2727
getDebugLoc ());
2729
2728
}
2730
2729
@@ -2756,7 +2755,7 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
2756
2755
VPWidenLoadEVLRecipe (VPWidenLoadRecipe &L, VPValue &EVL, VPValue *Mask)
2757
2756
: VPWidenMemoryRecipe(VPDef::VPWidenLoadEVLSC, L.getIngredient(),
2758
2757
{L.getAddr (), &EVL}, L.isConsecutive(),
2759
- L.isReverse(), L.getMetadata() , L.getDebugLoc()),
2758
+ L.isReverse(), L, L.getDebugLoc()),
2760
2759
VPValue (this , &getIngredient ()) {
2761
2760
setMask (Mask);
2762
2761
}
@@ -2794,7 +2793,7 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
2794
2793
struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
2795
2794
VPWidenStoreRecipe (StoreInst &Store, VPValue *Addr, VPValue *StoredVal,
2796
2795
VPValue *Mask, bool Consecutive, bool Reverse,
2797
- MDArrayRef Metadata, DebugLoc DL)
2796
+ const VPIRMetadata & Metadata, DebugLoc DL)
2798
2797
: VPWidenMemoryRecipe(VPDef::VPWidenStoreSC, Store, {Addr, StoredVal},
2799
2798
Consecutive, Reverse, Metadata, DL) {
2800
2799
setMask (Mask);
@@ -2803,7 +2802,7 @@ struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
2803
2802
VPWidenStoreRecipe *clone () override {
2804
2803
return new VPWidenStoreRecipe (cast<StoreInst>(Ingredient), getAddr (),
2805
2804
getStoredValue (), getMask (), Consecutive,
2806
- Reverse, getMetadata () , getDebugLoc ());
2805
+ Reverse, * this , getDebugLoc ());
2807
2806
}
2808
2807
2809
2808
VP_CLASSOF_IMPL (VPDef::VPWidenStoreSC);
@@ -2837,7 +2836,7 @@ struct VPWidenStoreEVLRecipe final : public VPWidenMemoryRecipe {
2837
2836
VPWidenStoreEVLRecipe (VPWidenStoreRecipe &S, VPValue &EVL, VPValue *Mask)
2838
2837
: VPWidenMemoryRecipe(VPDef::VPWidenStoreEVLSC, S.getIngredient(),
2839
2838
{S.getAddr (), S.getStoredValue (), &EVL},
2840
- S.isConsecutive(), S.isReverse(), S.getMetadata() ,
2839
+ S.isConsecutive(), S.isReverse(), S,
2841
2840
S.getDebugLoc()) {
2842
2841
setMask (Mask);
2843
2842
}
0 commit comments