<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 --- - [LIR] Misses simple memset case"
href="https://llvm.org/bugs/show_bug.cgi?id=25509">25509</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[LIR] Misses simple memset case
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Loop Optimizer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mcrosier@codeaurora.org
</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>LLVM is unable to generate a memset from the below test:
void test(int *arr) {
for (int i = 0; i < 1024; ++i) {
arr[i] = 0;
arr[i+1024] = 0;
}
}
As of r252817 clang produces:
test: // @test
// BB#0: // %entry
mov x8, xzr
movi v0.2d, #0000000000000000
.LBB0_1: // %vector.body
// =>This Inner Loop Header: Depth=1
add x9, x0, x8
add x8, x8, #16 // =16
str q0, [x9]
str q0, [x9, #4096]
cmp x8, #1, lsl #12 // =4096
b.ne .LBB0_1
// BB#2: // %for.cond.cleanup
ret
GCC is able to generate 2 memsets (one per arr access). If I'm not mistaken
this can be transformed into a single memset (i.e., memset(arr, 0, 2048)).</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>