[llvm] [VPlan] Implement printing VPIRMetadata. (PR #168385)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 25 04:03:44 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() &&
----------------
fhahn wrote:
I think we can ensure `Kind != 0` on construction, the other is only related to printing, so I kept it
https://github.com/llvm/llvm-project/pull/168385
More information about the llvm-commits
mailing list