Open
Description
Bugzilla Link | 18449 |
Version | unspecified |
OS | Linux |
CC | @atrick,@hfinkel |
Extended Description
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 rust-lang/rust#9024