<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 - Size regression -Os performing loop peeling"
href="https://bugs.llvm.org/show_bug.cgi?id=45423">45423</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Size regression -Os performing loop peeling
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>michaeljclark@mac.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>FYI. Clang 10.0.0 appears to be peeling and inlining the first iteration of a
loop into the loop header at -Os, whereas Clang 9.0.0 does not.
#include <vector>
void freq_rescale_4(std::vector<size_t> &F)
{
for (size_t i = 0, j = F.size(); i < j; i++) {
F[i] /= 2;
if (F[i] < 1) {
F[i] = 1;
}
}
}
# Clang 9.0.0, x86_64, -Os
freq_rescale_4(std::vector<unsigned long, std::allocator<unsigned long> >&):
mov rax, qword ptr [rdi]
mov rcx, qword ptr [rdi + 8]
sub rcx, rax
je .LBB0_3
sar rcx, 3
xor edx, edx
mov esi, 1
.LBB0_2: # =>This Inner Loop Header: Depth=1
mov rdi, qword ptr [rax + 8*rdx]
shr rdi
cmove rdi, rsi
mov qword ptr [rax + 8*rdx], rdi
add rdx, rsi
cmp rdx, rcx
jb .LBB0_2
.LBB0_3:
ret
# Clang 10.0.0, x86_64, -Os
freq_rescale_4(std::vector<unsigned long, std::allocator<unsigned long> >&):)
mov rdx, qword ptr [rdi]
mov rax, qword ptr [rdi + 8]
sub rax, rdx
je .LBB0_4
sar rax, 3
mov rsi, qword ptr [rdx]
shr rsi
mov r8d, 1
cmove rsi, r8
mov qword ptr [rdx], rsi
cmp rax, 2
jb .LBB0_4
mov edx, 1
.LBB0_3: # =>This Inner Loop Header: Depth=1
mov rsi, qword ptr [rdi]
mov rcx, qword ptr [rsi + 8*rdx]
shr rcx
cmove rcx, r8
mov qword ptr [rsi + 8*rdx], rcx
inc rdx
cmp rdx, rax
jb .LBB0_3
.LBB0_4:
ret</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>