[llvm-bugs] [Bug 47904] New: [SCEV] Unable to determine precise trip multiple from assumes using URem.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 19 09:23:50 PDT 2020


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

            Bug ID: 47904
           Summary: [SCEV] Unable to determine precise trip multiple from
                    assumes using URem.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: florian_hahn at apple.com
                CC: llvm-bugs at lists.llvm.org

We currently are unable to determine a precise trip multiple for loops using
information from assumes.

For example for the code below, we fail to determine a trip multiple of 4.

https://godbolt.org/z/9zMWKW

define void @test_trip_multiple_4(i32 %num) {
entry:
  %u = urem i32 %num, 4
  %cmp = icmp eq i32 %u, 0
  tail call void @llvm.assume(i1 %cmp)
  %cmp.1 = icmp uge i32 %num, 4
  tail call void @llvm.assume(i1 %cmp.1)
  br label %for.body

for.body:
  %i.010 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
  %inc = add nuw nsw i32 %i.010, 1
  %cmp2 = icmp ult i32 %inc, %num
  br i1 %cmp2, label %for.body, label %exit

exit:
  ret void
}


declare void @llvm.assume(i1)



This is one issue causing sub-optimal optimizations for an example shared on
IRC https://godbolt.org/z/49erfa

-- 
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/20201019/6c381795/attachment.html>


More information about the llvm-bugs mailing list