[llvm-bugs] [Bug 52411] New: Missed range check narrowing opportunity

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 4 15:48:23 PDT 2021


            Bug ID: 52411
           Summary: Missed range check narrowing opportunity
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: listmail at philipreames.com
                CC: llvm-bugs at lists.llvm.org

The following transform is not performed in O3 today.  Essentially, we end up
performing a redundant extend just to perform a range check.  This particular
example has been alive verified, but I have not tried to generalize under what
set of ranges the bitwidth reduction can be done. 

define i1 @src(i8 %x) {
  %conv28 = zext i8 %x to i32
  %isdigittmp = add nsw i32 %conv28, -48
  %isdigit = icmp ugt i32 %isdigittmp, 9
  ret i1 %isdigit

define i1 @tgt(i8 %x) {
  %isdigittmp = add i8 %x, -48
  %isdigit = icmp ugt i8 %isdigittmp, 9
  ret i1 %isdigit

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/20211104/d8c509bc/attachment.html>

More information about the llvm-bugs mailing list