<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [InstCombine] reduce logic-of-compares with limit constant"
   href="https://bugs.llvm.org/show_bug.cgi?id=45618">45618</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InstCombine] reduce logic-of-compares with limit constant
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This might be the generalization that I was looking for in <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Failure to optimize certain kind of always-true comparisons"
   href="show_bug.cgi?id=45510">bug 45510</a>:

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
}

<a href="http://volta.cs.utah.edu:8080/z/xh7J4T">http://volta.cs.utah.edu:8080/z/xh7J4T</a>

See D78430 for the large number of potential variations on this pattern:
<a href="https://reviews.llvm.org/D78430">https://reviews.llvm.org/D78430</a>

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".</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>