[llvm-bugs] [Bug 50511] New: [LoopDeletion] Infinite loop removed without mustprogress

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 27 11:36:38 PDT 2021


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

            Bug ID: 50511
           Summary: [LoopDeletion] Infinite loop removed without
                    mustprogress
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nikita.ppv at gmail.com
                CC: jdoerfert at anl.gov, llvm-bugs at lists.llvm.org

define void @test(i1 %c1, i1 %c2) {
  br label %loop1

loop1:
  br i1 %c1, label %loop1.latch, label %loop2

loop2:
  br i1 %c2, label %loop1.latch, label %loop2

loop1.latch:
  br i1 false, label %loop1, label %exit

exit:
  ret void
}

opt -S -loop-deletion

define void @test(i1 %c1, i1 %c2) {
  br label %exit

exit:                                             ; preds = %0
  ret void
}

Note that the original code goes into an infinite loop for %c1=false, %c2=false
and the function is not mustprogress.

While LoopDeletion makes sure that the loop has a finite trip count, it does
not account for an inner infinite loop.

-- 
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/20210527/61aae747/attachment.html>


More information about the llvm-bugs mailing list