diff options
author | Wouter van Oortmerssen <aardappel@gmail.com> | 2021-01-05 16:58:21 -0800 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2021-01-07 10:31:38 -0800 |
commit | 5c38ae36c58f5b6bb4a32e9ec2187fde86cf94b8 (patch) | |
tree | f81a795ff429b8a49c82732e012cb99285a85198 /llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp | |
parent | c9122ddef5213fbdd2d82c473a74e1742010f62f (diff) | |
download | llvm-5c38ae36c58f5b6bb4a32e9ec2187fde86cf94b8.zip llvm-5c38ae36c58f5b6bb4a32e9ec2187fde86cf94b8.tar.gz llvm-5c38ae36c58f5b6bb4a32e9ec2187fde86cf94b8.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp index 2101676..9014b8f 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp @@ -241,6 +241,10 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) { auto Local = static_cast<unsigned>(MI.getOperand(1).getImm()); Reg2Local[Reg] = Local; checkFrameBase(MFI, Local, Reg); + + // Update debug value to point to the local before removing. + WebAssemblyDebugValueManager(&MI).replaceWithLocal(Local); + MI.eraseFromParent(); Changed = true; } |