[llvm-bugs] [Bug 45618] New: [InstCombine] reduce logic-of-compares with limit constant

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 20 06:29:01 PDT 2020


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

            Bug ID: 45618
           Summary: [InstCombine] reduce logic-of-compares with limit
                    constant
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org

This might be the generalization that I was looking for in bug 45510:

define i1 @src(i8 %x, i8 %y) {
  %cmpeq = icmp eq i8 %x, 0
  %cmp = icmp sgt i8 %x, %y
  %r = and i1 %cmp, %cmpeq
  ret i1 %r
}

define i1 @tgt(i8 %x, i8 %y)  {
  %cmpeq = icmp eq i8 %x, 0
  %cmp = icmp sgt i8 0, %y
  %r = and i1 %cmp, %cmpeq
  ret i1 %r
}

http://volta.cs.utah.edu:8080/z/xh7J4T

See D78430 for the large number of potential variations on this pattern:
https://reviews.llvm.org/D78430

In that patch, we are focused on the instsimplify-able cases, but if we think
about this as an equal value constant substitution into the non-equality
compare, it applies to more (all?) predicates and constants, and some
combinations "simplify" while others just "combine".

-- 
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/20200420/91116fc7/attachment.html>


More information about the llvm-bugs mailing list