[LLVMbugs] [Bug 18449] New: Missing branch elimination in a trivial loop

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jan 12 06:10:24 PST 2014


            Bug ID: 18449
           Summary: Missing branch elimination in a trivial loop
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: bsteinbr at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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()

    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() {
      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 https://github.com/mozilla/rust/issues/9024

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140112/8a1951f2/attachment.html>

More information about the llvm-bugs mailing list