Skip to content

[flang][debug] Number function arguments in FIR #131829

Open
@vzakhari

Description

@vzakhari

AddDebugInfo pass uses fragile logic for figuring out the positional number of a dummy argument in the list of function arguments. This causes issues like #131672

It seems that we need to number the dummy arguments in a more reliable way, e.g. attribute [hl]fir.declare operations with the proper number early in the pipeline (maybe even during lowering).

There are some questions that I do not know answers for. @abidh please feel free to comment, if you know the answers.

  1. How is the numbering affected by AbstractResultOpt pass that may introduce a new function argument for the result of function? E.g. let's say we set number 1 for the first Fortran dummy argument of a function. Then AbstractResultOpt adds a new dummy argument before the first one. Should all the numbers shift at this time?
  2. How is the numbering affected by MLIR inlining? E.g. when a callee with dummy arguments is inlined into the caller, should we still attribute those used to be dummy arguments with arg = ...?
  3. How is the numbering affected by ABI handling. E.g. if a single Fortran dummy argument is received by a function via two low-level function arguments, does it mean the positional numbers should be shifted at this point?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions