[llvm-bugs] [Bug 48900] New: [InstCombine] Infinite loop with select / icmp

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 27 07:54:47 PST 2021


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

            Bug ID: 48900
           Summary: [InstCombine] Infinite loop with select / icmp
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: florian_hahn at apple.com
                CC: llvm-bugs at lists.llvm.org

Running `opt -instcombine` on the function below triggers an infinite loop in
instcombine and it looks like it does not get caught by the existing checks.


define i32 @clamp_check_for_no_infinite_loop3(i32 %i) {
  %i2 = icmp ugt i32 %i, 1
  %i3 = select i1 %i2, i32 %i, i32 1
  %i4 = icmp sgt i32 %i3, 0
  br i1 %i4, label %truelabel, label %falselabel

truelabel:                                        ; preds = %0
  %i5 = icmp slt i32 %i3, 2
  %i6 = select i1 %i5, i32 %i3, i32 2
  %i7 = shl nuw nsw i32 %i6, 2
  ret i32 %i7

falselabel:                                       ; preds = %0
  ret i32 0
}



This is a reduced version of
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29957

-- 
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/20210127/98dd77a3/attachment.html>


More information about the llvm-bugs mailing list