<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 --- - [indvars] Redundant loop increment after IV widening"
href="https://llvm.org/bugs/show_bug.cgi?id=28620">28620</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[indvars] Redundant loop increment after IV widening
</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>All
</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>apilipenko@azulsystems.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>Created <span class=""><a href="attachment.cgi?id=16770" name="attach_16770" title="Reproducer">attachment 16770</a> <a href="attachment.cgi?id=16770&action=edit" title="Reproducer">[details]</a></span>
Reproducer
On the following loop indvars creates a wider IV but fails to eliminate a
narrow type increment leading to an extra computation inside of the loop:
loop:
%i = phi i32 [ %i.next, %loop ], [ %i.entry, %entry ]
%guard.cond = icmp ult i32 %i, %guard.1.limit
call void (i1, ...) @llvm.experimental.guard(i1 %guard.cond, i32 9) [
"deopt"(i32 1) ]
%i.zext = zext i32 %i to i64
call void @consume(i64 %i.zext)
%i.next = add i32 %i, 1
%go.next = icmp slt i32 %i.next, %n
br i1 %go.next, label %loop, label %exit
After indvars:
loop:
%indvars.iv = phi i64 [ %indvars.iv.next, %loop ], [ %0, %entry ]
%guard.cond = icmp ult i64 %indvars.iv, %1
call void (i1, ...) @llvm.experimental.guard(i1 %guard.cond, i32 9) [
"deopt"(i32 1) ]
call void @consume(i64 %indvars.iv)
%2 = trunc i64 %indvars.iv to i32
%i.next = add i32 %2, 1
%go.next = icmp slt i32 %i.next, %n
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br i1 %go.next, label %loop, label %exit
The problem is not specific to guards, lowering it before indvars leads to the
same result.</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>