<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 - Improve DSE with libcalls"
href="https://bugs.llvm.org/show_bug.cgi?id=47644">47644</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Improve DSE with libcalls
</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>Scalar Optimizations
</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>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>void f(const char *s) {
char a[256];
__builtin_strcpy(a, s); // dead store
}
void g(const char *s) {
char a[256];
__builtin_memcpy(a, s, sizeof a); // dead store
}
char d[256];
void h(const char *s) {
__builtin_strcpy(d, s); // dead store
__builtin_memset(d, 0, sizeof d);
}
Clang:
f(char const*): # @f(char const*)
sub rsp, 264
mov rsi, rdi
mov rdi, rsp
call strcpy
add rsp, 264
ret
g(char const*): # @g(char const*)
ret
h(char const*): # @h(char const*)
push rax
mov rsi, rdi
mov edi, offset d
call strcpy
xorps xmm0, xmm0
movaps xmmword ptr [rip + d], xmm0
movaps xmmword ptr [rip + d+16], xmm0
movaps xmmword ptr [rip + d+32], xmm0
movaps xmmword ptr [rip + d+48], xmm0
movaps xmmword ptr [rip + d+64], xmm0
movaps xmmword ptr [rip + d+80], xmm0
movaps xmmword ptr [rip + d+96], xmm0
movaps xmmword ptr [rip + d+112], xmm0
movaps xmmword ptr [rip + d+128], xmm0
movaps xmmword ptr [rip + d+144], xmm0
movaps xmmword ptr [rip + d+160], xmm0
movaps xmmword ptr [rip + d+176], xmm0
movaps xmmword ptr [rip + d+192], xmm0
movaps xmmword ptr [rip + d+208], xmm0
movaps xmmword ptr [rip + d+224], xmm0
movaps xmmword ptr [rip + d+240], xmm0
pop rax
ret
d:
.zero 256
We should be able eliminate strcpy calls (based on deref. bytes info, memset
overwrites the whole buffer)</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>