<html>
<head>
<base href="http://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 --- - gvn does not remove loads after loop"
href="http://llvm.org/bugs/show_bug.cgi?id=18848">18848</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>gvn does not remove loads after loop
</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>tobias@grosser.es
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=12064" name="attach_12064" title="The LLVM-IR file to reproduce this bug">attachment 12064</a> <a href="attachment.cgi?id=12064&action=edit" title="The LLVM-IR file to reproduce this bug">[details]</a></span>
The LLVM-IR file to reproduce this bug
When computing the following C code:
void f(float *restrict A, float *restrict B, long N) {
B[0] = A[0];
for (long i = 1; i < N - 1; i += 1) {
B[i - 1] += A[i];
B[i] = A[i]; // Last iteration: B[N-2] = A[N-2];
}
B[N - 2] += A[N - 1];
}
global value numbering successfully eliminates redundant loads from B within
the loop body, but it does not eliminate the redundant load of B right after
the loop body.
The attached test case was slightly simplified to ensure the loop body
dominates the statement after it.
When running the following command 'opt -basicaa store.preopt.ll -gvn
-scalar-evolution -analyze' we get the following information:
Index of store in the loop body:
%arrayidx6 = getelementptr inbounds float* %B, i64 %storemerge9
--> {(4 + %B),+,4}<nsw><%for.body> Exits: (-8 + (4 * %N) + %B)
Index of load after the loop:
%arrayidx11 = getelementptr inbounds float* %B, i64 %sub10
--> (-8 + (4 * %N) + %B)
Both registers have the same value after the loop. We should eliminate both the
load that comes right after the store as well as the unnecessary index
computation.</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>