<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:florian_hahn@apple.com" title="Florian Hahn <florian_hahn@apple.com>"> <span class="fn">Florian Hahn</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - llvm doesn't do range analysis on induction variable"
href="https://bugs.llvm.org/show_bug.cgi?id=4914">bug 4914</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>florian_hahn@apple.com
</td>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>FIXED
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - llvm doesn't do range analysis on induction variable"
href="https://bugs.llvm.org/show_bug.cgi?id=4914#c10">Comment # 10</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - llvm doesn't do range analysis on induction variable"
href="https://bugs.llvm.org/show_bug.cgi?id=4914">bug 4914</a>
from <span class="vcard"><a class="email" href="mailto:florian_hahn@apple.com" title="Florian Hahn <florian_hahn@apple.com>"> <span class="fn">Florian Hahn</span></a>
</span></b>
<pre>It looks like all 3 points are done by LLVM now (<a href="https://godbolt.org/z/4VfEXx">https://godbolt.org/z/4VfEXx</a>).
With -S -emit-llvm -O3 -fno-vectorize -g0 -mllvm -unroll-max-count=1, we
generate the following loop body, with just a single compare:
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %7, %1 ]
%3 = phi i32 [ 0, %0 ], [ %8, %1 ]
%4 = icmp ult i32 %3, 255
%5 = select i1 %4, i32 %3, i32 255
%6 = add i32 %2, 255
%7 = add i32 %6, %5
%8 = add nuw nsw i32 %3, 1
%9 = icmp eq i32 %8, 1000000000
br i1 %9, label %10, label %1
Arguably, we still could still try to sink the add 255 out of the loop.</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>