<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 - Two-loop-deep loop peeling? ("loop scalar remainder splitting")"
href="https://bugs.llvm.org/show_bug.cgi?id=43892">43892</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Two-loop-deep loop peeling? ("loop scalar remainder splitting")
</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>Loop Optimizer
</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>This is indeed similar to scalarization of loop remainer.
Let's suppose we have a loop like: (can be written with a `break;` too)
void sink();
#define N 3
void bad(int width) {
for(int col = 0; col < width; col += N) {
int colsToRemaining = width - col;
int colsToFill = std::min(colsToRemaining, N);
for(int i = 0; i < colsToFill; ++i) {
// can't unroll/vectorize loop,
// variable ([1,N)) trip count
sink();
}
}
}
That std::min() conditional trip count is pretty unfortunate,
since in majority of cases colsToFill will be N.
It would be great to split the loop into something like
void good(int width) {
for(int col = 0; col < width; col += N) {
int colsToRemaining = width - col;
if(colsToRemaining >= N) {
for(int i = 0; i < N; ++i) // can unroll
sink(); // always runs N times
} else {
for(int i = 0; i < colsToRemaining; ++i) {
// can't unroll/vectorize loop,
// variable ([1,N)) trip count
sink();
}
}
}
}
That allows to unroll the first inner loop with constant trip count,
and may help with vectorization.
Should something like this be performed?</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>