<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 --- - Missing branch elimination in a trivial loop"
href="http://llvm.org/bugs/show_bug.cgi?id=18449">18449</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missing branch elimination in a trivial loop
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bsteinbr@gmail.com
</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>Given this code:
; ModuleID = '<stdin>'
define void @test() {
"function top level":
br label %loop
loop: ; preds = %body,
%"function top level"
%0 = phi i64 [ 0, %"function top level" ], [ %2, %body ]
%1 = icmp ugt i64 %0, 2
br i1 %1, label %fail, label %body
fail: ; preds = %loop
tail call void @bounds_fail()
unreachable
body: ; preds = %loop
%2 = add i64 %0, 1
%3 = icmp slt i64 %2, 3
br i1 %3, label %loop, label %out
out: ; preds = %body
ret void
}
declare void @bounds_fail()
`opt` from LLVM 3.2 was able to optimize that to:
; ModuleID = '<stdin>'
define void @test() {
body.2:
ret void
}
But `opt` from LLVM 3.3, 3.4 and 3.5~svn197556-1 (from Debian Sid) fail to do
so and leave the code unchanged.
This is from rust issue <a href="https://github.com/mozilla/rust/issues/9024">https://github.com/mozilla/rust/issues/9024</a></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>