<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 - Missed range check narrowing opportunity"
   href="https://bugs.llvm.org/show_bug.cgi?id=52411">52411</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missed range check narrowing opportunity
          </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>Linux
          </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>listmail@philipreames.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
}</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>