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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Sep 18 03:04:11 PDT 2026


================
@@ -253,13 +247,17 @@ LoopMetadataConversion::lookupMDNodes(StringRef name) {
 
 FailureOr<LoopAnnotationAttr>
 LoopMetadataConversion::lookupFollowupNode(StringRef name) {
-  auto node = lookupMDNode(name);
-  if (failed(node))
-    return failure();
-  if (*node == nullptr)
+  const llvm::MDNode *followup = lookupAndEraseProperty(name);
+  if (!followup)
     return LoopAnnotationAttr(nullptr);
 
-  return loopAnnotationImporter.translateLoopAnnotation(*node, loc);
+  LoopAnnotationAttr attr =
+      LoopMetadataConversion(followup, loc, loopAnnotationImporter, activeNodes,
+                             InputKind::Followup)
+          .convert();
----------------
ardenyang0125 wrote:

Thanks for the suggestion. I've split the entry points into convert and convertFollowup, with the shared conversion logic in convertImpl.

convert creates the recursion-tracking state, while convertFollowup reuses it and handles follow-up-specific validation and empty follow-ups.

The three targeted regression tests still pass.

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


More information about the Mlir-commits mailing list