<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 - Undesirable rematerialization of stack address computation"
href="https://bugs.llvm.org/show_bug.cgi?id=36491">36491</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Undesirable rematerialization of stack address computation
</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>Linux
</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>Backend: AArch64
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>eugeni.stepanov@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>$ cat 1.c
void use(void *);
void *p;
void f() {
int x;
p = &x;
use(&x);
}
$ bin/clang 1.c -target aarch64-linux-android -O3 -fomit-frame-pointer -c &&
bin/llvm-objdump -d -r 1.o
0: fe 0f 1f f8 str x30, [sp, #-16]!
4: 08 00 00 90 adrp x8, #0
0000000000000004: R_AARCH64_ADR_PREL_PG_HI21 p
8: e9 33 00 91 add x9, sp, #12
c: e0 33 00 91 add x0, sp, #12
10: 09 01 00 f9 str x9, [x8]
0000000000000010: R_AARCH64_LDST64_ABS_LO12_NC p
14: 00 00 00 94 bl #0
0000000000000014: R_AARCH64_CALL26 use
18: fe 07 41 f8 ldr x30, [sp], #16
1c: c0 03 5f d6 ret
Here x0 and x9 could be merged, but RegisterCoalescer would never consider
merging into a physical register. Instead it remats ADDXri %stack.0.x, 0, 0.
This is specific to AArch64 backend. The same does not happen on X86 because
ADDXri is asCheapAsAMove, while LEA is not.</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>