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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to