[llvm-bugs] [Bug 28944] New: IRCE breaks loop-info

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 11 18:50:50 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28944

            Bug ID: 28944
           Summary: IRCE breaks loop-info
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: michael.v.zolotukhin at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

When trying to improve LoopInfo verifier, I found that one of IRCE tests
started to fail. Looks like it doesn't update LI as it creates new loops, or
something like this.

To reproduce apply a patch from https://reviews.llvm.org/D23437 and then:

$ cat fail.ll
define void @inner_loop(i32* %arr, i32* %a_len_ptr, i32 %n) {
entry:
  %len = load i32, i32* %a_len_ptr, !range !0
  %first.itr.check = icmp sgt i32 %n, 0
  br i1 %first.itr.check, label %loop, label %exit

loop:                                             ; preds = %in.bounds, %entry
  %idx = phi i32 [ 0, %entry ], [ %idx.next, %in.bounds ]
  %idx.next = add i32 %idx, 1
  %abc = icmp slt i32 %idx, %len
  br i1 %abc, label %in.bounds, label %out.of.bounds

in.bounds:                                        ; preds = %loop
  %addr = getelementptr i32, i32* %arr, i32 %idx
  store i32 0, i32* %addr
  %next = icmp slt i32 %idx.next, %n
  br i1 %next, label %loop, label %exit

out.of.bounds:                                    ; preds = %loop
  ret void

exit:                                             ; preds = %in.bounds, %entry
  ret void
}

!0 = !{i32 0, i32 2147483647}

$ opt -verify-loop-info -irce-print-changed-loops -irce < ww.ll -S
irce: in function inner_loop: constrained Loop at depth 1 containing:
%loop<header><exiting>,%in.bounds<latch><exiting>
Assertion failed: (LoopHeaders1.size() == LoopHeaders2.size() && "LoopInfo is
incorrect."), function verifyByRecomputation, file
/Users/mvzolotu/devel/trunk/llvm/include/llvm/Analysis/LoopInfoImpl.h, line
600.
Stack dump:
0.      Program arguments: bin/opt -verify-loop-info -irce-print-changed-loops
-irce -S
1.      Running pass 'Function Pass Manager' on module '<stdin>'.
2.      Running pass 'Loop Pass Manager' on function '@inner_loop'
Abort trap: 6

-- 
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/20160812/6d417254/attachment-0001.html>


More information about the llvm-bugs mailing list