[all-commits] [llvm/llvm-project] 340b0c: [llvm] Add DW_CC_nocall to function debug metadata...

Venkata Ramanaiah Nalamothu via All-commits all-commits at lists.llvm.org
Tue Jun 14 15:00:31 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 340b0ca90095d838f095271aaa1098fa1bd5ecbe
  Author: Venkata Ramanaiah Nalamothu <VenkataRamanaiah.Nalamothu at amd.com>
  Date:   2022-06-15 (Wed, 15 Jun 2022)

  Changed paths:
    M llvm/include/llvm/IR/DebugInfoMetadata.h
    M llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
    M llvm/test/Transforms/DeadArgElim/2010-04-30-DbgInfo.ll

  Log Message:
  [llvm] Add DW_CC_nocall to function debug metadata when either return values or arguments are removed

Adding the `DW_CC_nocall` calling convention to the function debug metadata is needed when either the return values or the arguments of a function are removed as this helps in informing debugger that it may not be safe to call this function or try to interpret the return value.
This translates to setting `DW_AT_calling_convention` with `DW_CC_nocall` for appropriate DWARF DIEs.

The DWARF5 spec (section Calling Convention Information) says:

If the `DW_AT_calling_convention` attribute is not present, or its value is the constant `DW_CC_normal`, then the subroutine may be safely called by obeying the `standard` calling conventions of the target architecture. If the value of the calling convention attribute is the constant `DW_CC_nocall`, the subroutine does not obey standard calling conventions, and it may not be safe for the debugger to call this subroutine.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D127134

More information about the All-commits mailing list