@@ -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
@@ -3618,6 +3642,7 @@ void VPWidenLoadRecipe::print(raw_ostream &O, const Twine &Indent,
36183642 printAsOperand (O, SlotTracker);
36193643 O << " = load " ;
36203644 printOperands (O, SlotTracker);
3645+ VPIRMetadata::print (O, getParent ()->getPlan ()->getModule ());
36213646}
36223647#endif
36233648
@@ -3739,6 +3764,7 @@ void VPWidenStoreRecipe::print(raw_ostream &O, const Twine &Indent,
37393764 VPSlotTracker &SlotTracker) const {
37403765 O << Indent << " WIDEN store " ;
37413766 printOperands (O, SlotTracker);
3767+ VPIRMetadata::print (O, getParent ()->getPlan ()->getModule ());
37423768}
37433769#endif
37443770
0 commit comments