<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 - Extra spilli/reload around function call"
href="https://bugs.llvm.org/show_bug.cgi?id=47625">47625</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Extra spilli/reload around function call
</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>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.bolvansky@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>double a[8], b[8];
int x;
void __attribute__((noinline))
bar (void)
{
x = 1;
}
void __attribute__((noinline))
foo(int i)
{
double t1 = a[i];
bar ();
b[i] = 2*t1;
}
CLang -O3:
bar(): # @bar()
mov dword ptr [rip + x], 1
ret
foo(int): # @foo(int)
push rbx
sub rsp, 16
movsxd rbx, edi
movsd xmm0, qword ptr [8*rbx + a] # xmm0 = mem[0],zero
movsd qword ptr [rsp + 8], xmm0 # 8-byte Spill
call bar()
movsd xmm0, qword ptr [rsp + 8] # 8-byte Reload
addsd xmm0, xmm0
movsd qword ptr [8*rbx + b], xmm0
add rsp, 16
pop rbx
ret
GCC -O3:
bar():
mov DWORD PTR x[rip], 1
ret
foo(int):
movsx rdi, edi
movsd xmm0, QWORD PTR a[0+rdi*8]
call bar()
addsd xmm0, xmm0
movsd QWORD PTR b[0+rdi*8], xmm0
ret
<a href="https://godbolt.org/z/qKeEe8">https://godbolt.org/z/qKeEe8</a></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>