<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 - Redundant register zeroing"
href="https://bugs.llvm.org/show_bug.cgi?id=38706">38706</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Redundant register zeroing
</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: 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>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>int main(int argc, char **argv) {
int sum = 0;
int counter = 0;
for(counter = 1; counter < argc; counter++) {
char *aux = argv[counter];
while(*aux != '\0') {
aux++;
sum++;
}
}
printf("Sum = %d\n", sum);
}
Trunk -O3 -fno-unroll-loops:
main: # @main
mov rax, rsi
xor esi, esi
cmp edi, 2
jl .LBB0_6
mov ecx, edi
xor esi, esi <---- not needed
mov edx, 1
.LBB0_2:
mov rdi, qword ptr [rax + 8*rdx]
cmp byte ptr [rdi], 0
je .LBB0_5
add rdi, 1
3.8.1:
main: # @main
mov rax, rsi
xor esi, esi
mov ecx, 1
cmp edi, 2
jl .LBB0_5
.LBB0_1:
mov rdx, qword ptr [rax + 8*rcx]
cmp byte ptr [rdx], 0
je .LBB0_4
inc rdx
<a href="https://godbolt.org/z/veVclA">https://godbolt.org/z/veVclA</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>