Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workaround limitation in mlir handling of cyclic debug attributes.
This commit fixes an issue that can cause an assertion to fail in some circumstances at https://github.com/llvm/llvm-project/blob/26029d77a57cb4aaa1479064109e985a90d0edd8/mlir/lib/Target/LLVMIR/DebugTranslation.cpp#L270. The issue relates to the handling of recursive debug type in mlir. See the discussion at the end of follow PR for more details. llvm#106571 Problem could be explained with the following example code: type t2 type(t1), pointer :: p1 end type type t1 type(t2), pointer :: p2 end type In the description below, type_self means a temporary type that is generated as a place holder while the members of that type are being processed. If we process t1 first then we will have the following structure after it has been processed. t1 -> t2 -> t1_self This is because when we started processing t2, we did not have the complete t1 but its place holder t1_self. Now if some entity requires t2, we will already have that in cache and will return it. But this t2 refers to t1_self and not to t1. In mlir handling, only those types are allowed to have _self reference which are wrapped by entity whose reference it contains. So t1 -> t2 -> t1_self is ok because the t1_self reference can be resolved by the outer t1. But standalone t2 is not because there will be no way to resolve it. Please see DebugTranslation::translateRecursive for details on how mlir handles recursive types. The fix is not to cache the type that will fail if used standalone.
- Loading branch information