llvm / llvm/llvm-project

[flang][debug] Emit DW_TAG_inlined_subroutine and DW_AT_inline for inlined functions

Open
#176,042 8 comments 0 reactions 1 assignee Claimed by @timsmith78 View on GitHub
debuginfo flang:ir
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Consider the following minimal reproducer code,

```fortran
subroutine callee(x)
integer, intent(inout) :: x
x = x + 1
end subroutine

program main
integer :: val = 10
call callee(val)
print *, val
end program
```

With `gfortran -O2 -finline-functions -g`, the DWARF dump contains the following inlining related information,

`DW_TAG_inlined_subroutine` with `DW_AT_abstract_origin`
`DW_AT_inline: 1 (inlined)` on the original subroutine
`DW_AT_call_file: 1`, `DW_AT_call_line: 8` which are the call site location info

With `flang -O2 -finline-functions -g`, the DWARF only has the subroutine name - no inline tracking.

These debug information are useful and needed when profiling the program.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.