[Mlir-commits] [mlir] [mlir][LLVMIR] Fix loop follow-up metadata import and export (PR #223376)

Tobias Gysi llvmlistbot at llvm.org
Fri Sep 18 04:52:27 PDT 2026


================
@@ -16,12 +18,23 @@ using namespace mlir::LLVM::detail;
 namespace {
 /// Helper class that keeps the state of one metadata to attribute conversion.
 struct LoopMetadataConversion {
-  LoopMetadataConversion(const llvm::MDNode *node, Location loc,
-                         LoopAnnotationImporter &loopAnnotationImporter)
+  /// Converts a loop ID, owning the recursion state for its follow-ups.
+  static LoopAnnotationAttr convert(const llvm::MDNode *node, Location loc,
+                                    LoopAnnotationImporter &importer);
+
+private:
+  LoopMetadataConversion(
+      const llvm::MDNode *node, Location loc,
+      LoopAnnotationImporter &loopAnnotationImporter,
+      llvm::SmallPtrSetImpl<const llvm::MDNode *> &activeNodes)
       : node(node), loc(loc), loopAnnotationImporter(loopAnnotationImporter),
-        ctx(loc->getContext()){};
-  /// Converts this structs loop metadata node into a LoopAnnotationAttr.
-  LoopAnnotationAttr convert();
+        ctx(loc->getContext()), activeNodes(activeNodes) {}
+
+  /// Converts a follow-up using the current recursion state.
+  LoopAnnotationAttr convertFollowup(const llvm::MDNode *followup);
+
+  /// Converts the properties after the validated loop ID or follow-up header.
+  LoopAnnotationAttr convertImpl();
----------------
gysit wrote:

nit: ah should we call it `convertProperties` then? 

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


More information about the Mlir-commits mailing list