<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 - Failure to propagate memset pattern from alloca to reads"
href="https://bugs.llvm.org/show_bug.cgi?id=45783">45783</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Failure to propagate memset pattern from alloca to reads
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>lebedev.ri@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>int match8(char *tpl)
{
char cmp[32] = {0};
int found = 0;
for (int at = 0; at < 32; at++) {
if (tpl[at] == cmp[at]) {
found = 1;
}
}
return found;
}
Results in
define dso_local i32 @match8(i8* nocapture readonly %0) local_unnamed_addr #0 {
%2 = alloca [32 x i8], align 16
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %3) #3
call void @llvm.memset.p0i8.i64(i8* nonnull align 16 dereferenceable(32) %3,
i8 0, i64 32, i1 false)
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 20
%5 = load i8, i8* %4, align 4, !tbaa !2
<...>
But that last load should fold to 0.</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>