<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 --- - LLVM cannot unroll loops with multiple exits"
href="https://llvm.org/bugs/show_bug.cgi?id=27360">27360</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLVM cannot unroll loops with multiple exits
</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>Keywords</th>
<td>googler, performance
</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>danielcdh@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>davidxl@google.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>For the following test case:
bool foo(int i, int *m) {
int w = m[i];
#pragma unroll 8
while (w == 0) {
if (--i < 0) return false;
w = m[i];
}
return true;
}
"g++ -O2 -funroll-all-loops" can successfully unroll this loop (even without
pragma).
But LLVM rejects unrolling this loop because:
284│ // For now, only unroll loops that contain a single exit.
285├> if (!L->getExitingBlock())
286│ return false;
This makes llvm missing many optimization opportunities.</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>