<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Incorrect DW_AT_location attribute for call site parameter entry"
href="https://bugs.llvm.org/show_bug.cgi?id=44118">44118</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect DW_AT_location attribute for call site parameter entry
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.stenberg@ericsson.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
</td>
</tr></table>
<p>
<div>
<pre>Reproduced on 3889ff82bf4057ead22dad91a89384ac20ebd557.
Compiling the following file:
extern void callee(int, int);
extern int a;
int caller(int e, long c) {
callee(c, a);
return e;
}
using:
clang --target=aarch64 -O1 -g -Xclang -femit-debug-entry-values -c location.c
yields the following call site parameter entry:
0x00000087: DW_TAG_GNU_call_site_parameter
DW_AT_location (DW_OP_reg8 W8)
DW_AT_GNU_call_site_value
(DW_OP_GNU_entry_value(DW_OP_reg1 W1))
As seen, the DW_AT_location attribute specifies W8, but as this is a call site
entry for the first parameter, it should be W0.
In this case the value is described by a chain of instructions:
bb.0.entry:
liveins: $w0, $x1, $lr, $x19
[...]
$x8 = ORRXrs $xzr, killed $x1, 0
[...]
$w0 = ORRWrs $wzr, killed $w8, 0, implicit $x8, debug-location !26
BL @callee, csr_aarch64_aapcs
At a quick glance, it seems that this code in collectCallSiteParameters() only
resolves one step of the chain, resulting in the location becoming incorrect:
// Emit the call site parameter's value as an entry value.
if (ShouldTryEmitEntryVals) {
// Create an expression where the register's entry value is used.
DIExpression *EntryExpr = DIExpression::get(
MF->getFunction().getContext(), {dwarf::DW_OP_LLVM_entry_value, 1});
for (auto RegEntry : ForwardedRegWorklist) {
unsigned FwdReg = RegEntry;
auto EntryValReg = RegsForEntryValues.find(RegEntry);
if (EntryValReg != RegsForEntryValues.end())
FwdReg = EntryValReg->second;
DbgValueLoc DbgLocVal(EntryExpr, MachineLocation(RegEntry));
DbgCallSiteParam CSParm(FwdReg, DbgLocVal);
Params.push_back(CSParm);
++NumCSParams;
}
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>