aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2021-01-05 16:58:21 -0800
committerWouter van Oortmerssen <aardappel@gmail.com>2021-01-07 10:31:38 -0800
commit5c38ae36c58f5b6bb4a32e9ec2187fde86cf94b8 (patch)
treef81a795ff429b8a49c82732e012cb99285a85198 /llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
parentc9122ddef5213fbdd2d82c473a74e1742010f62f (diff)
downloadllvm-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.cpp4
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;
}