[all-commits] [llvm/llvm-project] f7420a: [flang][debug] Fix issue with argument numbering. ...

Abid Qadeer via All-commits all-commits at lists.llvm.org
Fri Jan 3 11:42:09 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f7420a9dff6d09715042b60c9e26a40a1b2a3147
      https://github.com/llvm/llvm-project/commit/f7420a9dff6d09715042b60c9e26a40a1b2a3147
  Author: Abid Qadeer <haqadeer at amd.com>
  Date:   2025-01-03 (Fri, 03 Jan 2025)

  Changed paths:
    M flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
    A flang/test/Integration/debug-116525.f90

  Log Message:
  -----------
  [flang][debug] Fix issue with argument numbering. (#120726)

Currently fir::isDummyArgument is being used to check if a DeclareOp
represents a dummy argument. The argument passed to the function is
declOp.getMemref(). This bypasses the code in isDummyArgument that
checks for dummy_scope because the `Value` returned by the getMemref()
may not have DeclareOp as its defining op.

This bypassing mean that sometime a variable will be marked as argument
when it should not. This happened in this case where same arg was being
used for 2 different result variables with use of `entry` in the
function.

The solution is to check directly if the declOp has a dummy_scope. If
yes, we know this is dummy argument. We can now check if the memref
points to the BlockArgument and use its number. This will still miss
arguments where memref does not directly point to a BlockArgument but
that is missed currently too. Note that we can still evaluate those
variable in debugger. It is just that they are not marked as arguments.

Fixes #116525.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list