<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 --- - Regression in removing pointer range loops initializing dead variables."
href="https://llvm.org/bugs/show_bug.cgi?id=28987">28987</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Regression in removing pointer range loops initializing dead variables.
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>edy.burt@gmail.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>The following function is optimized out in clang 3.8, but not 3.9:
void test() {
double a[4];
for(double *p = a, *end = a + 4; p < end; p++)
*p = 0.0;
}
The optimized IR on 3.9 is more or less:
define void @test() {
entry-block:
%a = alloca [4 x double], align 8
%a6 = ptrtoint [4 x double]* %a to i64
%0 = bitcast [4 x double]* %a to i8*
call void @llvm.lifetime.start(i64 32, i8* %0)
%scevgep = getelementptr [4 x double], [4 x double]* %a, i64 1, i64 0
%scevgep1 = ptrtoint double* %scevgep to i64
%scevgep2 = getelementptr [4 x double], [4 x double]* %a, i64 0, i64 1
%scevgep23 = ptrtoint double* %scevgep2 to i64
%1 = icmp ugt i64 %scevgep1, %scevgep23
%umax = select i1 %1, i64 %scevgep1, i64 %scevgep23
%umax45 = inttoptr i64 %umax to i8*
%2 = xor i64 %a6, -1
%uglygep = getelementptr i8, i8* %umax45, i64 %2
%uglygep7 = ptrtoint i8* %uglygep to i64
%3 = add i64 %uglygep7, 8
%4 = and i64 %3, -8
call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 %4, i32 8, i1 false)
call void @llvm.lifetime.end(i64 32, i8* %0)
ret void
}
If the llvm.lifetime.{start,end} calls are removed, running opt again will
reduce this to just "ret void".
Any other uses of %a will also prevent the memset and everything before it to
be removed, *even* if the entire array is statically overwritten.</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>