[WebAssembly] Fixed byval args missing DWARF DW_AT_LOCATION
authorWouter van Oortmerssen <aardappel@gmail.com>
Wed, 6 Jan 2021 00:58:21 +0000 (16:58 -0800)
committerWouter van Oortmerssen <aardappel@gmail.com>
Thu, 7 Jan 2021 18:31:38 +0000 (10:31 -0800)
commit5c38ae36c58f5b6bb4a32e9ec2187fde86cf94b8
treef81a795ff429b8a49c82732e012cb99285a85198
parentc9122ddef5213fbdd2d82c473a74e1742010f62f
[WebAssembly] Fixed byval args missing DWARF DW_AT_LOCATION

A struct in C passed by value did not get debug information. Such values are currently
lowered to a Wasm local even in -O0 (not to an alloca like on other archs), which becomes
a Target Index operand (TI_LOCAL). The DWARF writing code was not emitting locations
in for TI's specifically if the location is a single range (not a list).

In addition, the ExplicitLocals pass which removes the ARGUMENT pseudo instructions did
not update the associated DBG_VALUEs, and couldn't even find these values since the code
assumed such instructions are adjacent, which is not the case here.

Also fixed asm printing of TIs needed by a test.

Differential Revision: https://reviews.llvm.org/D94140
lld/test/wasm/debuginfo.test
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp
llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
llvm/test/CodeGen/WebAssembly/dbgvalue.ll
llvm/test/MC/WebAssembly/debug-byval-struct.ll [new file with mode: 0644]