[flang-commits] [flang] [flang] add extra component information in fir.type_info (PR #96746)

via flang-commits flang-commits at lists.llvm.org
Thu Jun 27 09:25:55 PDT 2024


jeanPerier wrote:

> Thanks for the PR. The lower bound is one of the missing things in debug info. With this PR, will this information be available in general or for array types which are components of a derived type?

Thanks for the review! Lower bounds outside of the derived type component case are linked to variables/SSA values, not types in FIR. They are part of the fir.declare operands. Adding lower bound info in an MLIR type (i.e., in fir.array<>) would makes the IR more complex/harder to read, and would only bring usable info when the the lower bounds are compile time constants since mlir::Type cannot depend on mlir::Value.

To get the lower bound info of variables, you will need to thread the fir.declare operation along the type and get the lower bound information from there.

In the case of derived type components, this info is not given in the fir.declare that is meant to hold the variable lower bounds, not the lower bounds of its components (given type nesting can be arbitrary, fir.declare of derived type could become arbitrarily complex), hence the extension of fir.type_info for that case.

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


More information about the flang-commits mailing list