[Mlir-commits] [mlir] [MLIR][LLVM] Support Recursive DITypes (PR #80251)

Billy Zhu llvmlistbot at llvm.org
Thu Feb 29 22:53:57 PST 2024


================
@@ -64,11 +63,7 @@ DICompositeTypeAttr DebugImporter::translateImpl(llvm::DICompositeType *node) {
     assert(element && "expected a non-null element type");
     elements.push_back(translate(element));
   }
-  // Drop the elements parameter if a cyclic dependency is detected. We
-  // currently cannot model these cycles and thus drop the parameter if
-  // required. A cyclic dependency is detected if one of the element nodes
-  // translates to a nullptr since the node is already on the translation stack.
-  // TODO: Support debug metadata with cyclic dependencies.
+  // Drop the elements parameter if any of the elements are invalid.
   if (llvm::is_contained(elements, nullptr))
     elements.clear();
----------------
zyx-billy wrote:

I think there's still [this one case](https://github.com/llvm/llvm-project/blob/dca32a3b594b3c91f9766a9312b5d82534910fa1/mlir/lib/Target/LLVMIR/DebugImporter.cpp#L77) where `translateImpl` can return nullptr even for non-recursive case. Not sure if it's worth adding a null check everywhere for this though, we can leave it as null if some attr is invalid.
Like you said, we can leave it like this for now and remove once we support more.

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


More information about the Mlir-commits mailing list