[llvm] [VPlan] Implement printing VPIRMetadata. (PR #168385)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 24 08:59:52 PST 2025


================
@@ -1706,6 +1711,28 @@ void VPIRMetadata::intersect(const VPIRMetadata &Other) {
   Metadata = std::move(MetadataIntersection);
 }
 
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+void VPIRMetadata::print(raw_ostream &O, const VPlan *Plan) const {
+  if (Metadata.empty() || !Plan)
+    return;
+
+  const Module &M = Plan->getModule();
+  SmallVector<StringRef, 8> MDNames;
+  M.getContext().getMDKindNames(MDNames);
+
+  O << " (";
+  interleaveComma(Metadata, O, [&](const auto &KindNodePair) {
+    auto [Kind, Node] = KindNodePair;
+    assert(Kind != 0 && "Debug metadata should not be managed by VPIRMetadata");
+    assert(Kind < MDNames.size() && !MDNames[Kind].empty() &&
----------------
david-arm wrote:

I wonder if these checks should actually live somewhere in the vplan verifier, rather than only checking when someone is dumping the recipe?

https://github.com/llvm/llvm-project/pull/168385


More information about the llvm-commits mailing list