<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - LoopStrengthReduce does not choose the optimum IV"
href="https://llvm.org/bugs/show_bug.cgi?id=28036">28036</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LoopStrengthReduce does not choose the optimum IV
</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>normal
</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>arnaud.degrandmaison@arm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16484" name="attach_16484" title="C testcase">attachment 16484</a> <a href="attachment.cgi?id=16484&action=edit" title="C testcase">[details]</a></span>
C testcase
The following trivial testcase:
void foo(int * restrict a, int * restrict b, int * restrict c, unsigned LEN) {
for (unsigned i = 0; i < LEN; i++)
c[i] = a[i] + b[i];
}
Compile with : clang -target aarch64-linux-gnu -O2 -Wall -S -o - test2.c
We get:
.LBB0_3:
and x8, x9, #0x1fffffff8
cbz x8, .LBB0_7
add x10, x0, #16
add x11, x1, #16
add x12, x2, #16
mov x13, x8
.LBB0_5:
ldp q0, q1, [x10, #-16]
ldp q2, q3, [x11, #-16]
sub x13, x13, #8
add x10, x10, #32
add x11, x11, #32
add v0.4s, v2.4s, v0.4s
add v1.4s, v3.4s, v1.4s
stp q0, q1, [x12, #-16]
add x12, x12, #32
cbnz x13, .LBB0_5
But I would have expected something like:
.LBB0_3:
and x8, x9, #0x1fffffff8
cbz x8, .LBB0_7
mov x13, x8
.LBB0_5:
ldp q0, q1, [x0], #32
ldp q2, q3, [x1], #32
sub x13, x13, #8
add v0.4s, v2.4s, v0.4s
add v1.4s, v3.4s, v1.4s
stp q0, q1, [x2], #32
cbnz x13, .LBB0_5
LoopStrengthReduce is transforming the code to a state which prevents using
writeback at all.</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>