[Mlir-commits] [flang] [mlir] [MLIR][LLVM] Make DISubprogramAttr cyclic (PR #106571)

Billy Zhu llvmlistbot at llvm.org
Mon Sep 23 14:33:59 PDT 2024


zyx-billy wrote:

Hi @abidh, IIUC are you talking about the case of mutual recursion? The way it works is we never "expose" attributes that contain unbound self-references. In your case, the debug importer is supposed to create two results (consisting of 6 distinct attributes):
```
t1 -> t2' -> t1_self
t2 -> t1' -> t2_self
```
Where `t1_self` & `t1` share the same rec_id, and `t2_self` & `t2` share the same rec_id. Note that `t1'` & `t2'` by themselves are illegal if they're ever referred to without `t1` or `t2` in an outer context. From outside, we only expect `t1` and `t2` to be used. So in your example, when exporting, we should always be processing `t1` or `t2` first before their `'` versions.

We have some test cases [starting here](https://github.com/llvm/llvm-project/blob/3bbe0f90f33357c27e3195207fa35c0fb44e426c/mlir/test/Target/LLVMIR/Import/debug-info.ll#L624) that might help explain how things would look (including some mutual recursions), but like @gysit says, feel free to let us know if you're seeing something that doesn't work properly though! 🙏 

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


More information about the Mlir-commits mailing list