@@ -1443,6 +1443,7 @@ void VPInstruction::print(raw_ostream &O, const Twine &Indent,
14431443
14441444 printFlags (O);
14451445 printOperands (O, SlotTracker);
1446+  VPIRMetadata::print (O, getParent ()->getPlan ()->getModule ());
14461447
14471448 if  (auto  DL = getDebugLoc ()) {
14481449 O << " , !dbg "  ;
@@ -1669,6 +1670,25 @@ void VPIRMetadata::intersect(const VPIRMetadata &Other) {
16691670 Metadata = std::move (MetadataIntersection);
16701671}
16711672
1673+ void  VPIRMetadata::print (raw_ostream &O, const  Module &M) const  {
1674+  if  (Metadata.empty ())
1675+  return ;
1676+ 
1677+  SmallVector<StringRef, 8 > MDNames;
1678+  M.getContext ().getMDKindNames (MDNames);
1679+ 
1680+  O << "  ("  ;
1681+  interleaveComma (Metadata, O, [&](const  auto  &KindNodePair) {
1682+  auto  [Kind, Node] = KindNodePair;
1683+  assert (Kind != 0  && " Debug metadata should not be managed by VPIRMetadata"  );
1684+  assert (Kind < MDNames.size () && !MDNames[Kind].empty () &&
1685+  " Unexpected unnamed metadata kind"  );
1686+  O << " !"   << MDNames[Kind] << "  "  ;
1687+  Node->printAsOperand (O, &M);
1688+  });
1689+  O << " )"  ;
1690+ }
1691+ 
16721692void  VPWidenCallRecipe::execute (VPTransformState &State) {
16731693 assert (State.VF .isVector () && " not widening"  );
16741694 assert (Variant != nullptr  && " Can't create vector function."  );
@@ -1729,6 +1749,7 @@ void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent,
17291749 Op->printAsOperand (O, SlotTracker);
17301750 });
17311751 O << " )"  ;
1752+  VPIRMetadata::print (O, getParent ()->getPlan ()->getModule ());
17321753
17331754 O << "  (using library function"  ;
17341755 if  (Variant->hasName ())
@@ -1863,6 +1884,7 @@ void VPWidenIntrinsicRecipe::print(raw_ostream &O, const Twine &Indent,
18631884 Op->printAsOperand (O, SlotTracker);
18641885 });
18651886 O << " )"  ;
1887+  VPIRMetadata::print (O, getParent ()->getPlan ()->getModule ());
18661888}
18671889#endif 
18681890
@@ -2255,6 +2277,7 @@ void VPWidenRecipe::print(raw_ostream &O, const Twine &Indent,
22552277 O << "  = "   << Instruction::getOpcodeName (Opcode);
22562278 printFlags (O);
22572279 printOperands (O, SlotTracker);
2280+  VPIRMetadata::print (O, getParent ()->getPlan ()->getModule ());
22582281}
22592282#endif 
22602283
@@ -2336,6 +2359,7 @@ void VPWidenCastRecipe::print(raw_ostream &O, const Twine &Indent,
23362359 printFlags (O);
23372360 printOperands (O, SlotTracker);
23382361 O << "  to "   << *getResultType ();
2362+  VPIRMetadata::print (O, getParent ()->getPlan ()->getModule ());
23392363}
23402364#endif 
23412365
@@ -3617,6 +3641,7 @@ void VPWidenLoadRecipe::print(raw_ostream &O, const Twine &Indent,
36173641 printAsOperand (O, SlotTracker);
36183642 O << "  = load "  ;
36193643 printOperands (O, SlotTracker);
3644+  VPIRMetadata::print (O, getParent ()->getPlan ()->getModule ());
36203645}
36213646#endif 
36223647
@@ -3738,6 +3763,7 @@ void VPWidenStoreRecipe::print(raw_ostream &O, const Twine &Indent,
37383763 VPSlotTracker &SlotTracker) const  {
37393764 O << Indent << " WIDEN store "  ;
37403765 printOperands (O, SlotTracker);
3766+  VPIRMetadata::print (O, getParent ()->getPlan ()->getModule ());
37413767}
37423768#endif 
37433769
0 commit comments