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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Sep 19 18:14:17 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();
----------------
ardenyang0125 wrote:

Agreed, convertProperties describes its purpose more clearly. Renamed the function and updated both call sites.

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


More information about the Mlir-commits mailing list