[llvm-bugs] [Bug 47513] New: SimpleLoopUnswitch incorrectly leaves make.implicit MD when there's an infinite loop

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Sep 13 23:10:06 PDT 2020


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

            Bug ID: 47513
           Summary: SimpleLoopUnswitch incorrectly leaves make.implicit MD
                    when there's an infinite loop
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: suc-daniil at yandex.ru
                CC: llvm-bugs at lists.llvm.org

Here's a test case:
cmd: opt -enable-nontrivial-unswitch=true
-passes='loop(unswitch),verify<loops>' -S < %s

define i32 @test_should_drop_make_implicit.infinite_loop(i32* %p1, i32* %p2,
i1* %p3) {
entry:
  %null_check = icmp eq i32* %p2, null
  br label %loop.header
loop.header:
  %iv = phi i32 [0, %entry], [%iv.next, %backedge]
  br label %possibly_infinite_loop
possibly_infinite_loop:
  %inner_loop.cond = load i1, i1* %p3
  br i1 %inner_loop.cond, label %possibly_infinite_loop, label %loop.body
loop.body:
  %x = load i32, i32* %p1
  %side_exit_cond = icmp eq i32 %x, 0
  br i1 %null_check, label %throw_npe, label %backedge, !make.implicit !0
backedge:
  %iv.next = add i32 %iv,1
  %loop_cond = icmp slt i32 %iv.next, 10000
  br i1 %loop_cond, label %loop.header, label %exit
throw_npe:
  call void @throw_npe()
  unreachable
exit:
  ret i32 %x
}

Due to a possibly infinite loop between the outer loop entry and the null
check, make.implicit MD should be dropped when we unswitch the loop on
%null_check condition. However, currently we keep that MD.

-- 
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/20200914/d86298fb/attachment.html>


More information about the llvm-bugs mailing list