<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Missing pattern in instcombine"
   href="https://llvm.org/bugs/show_bug.cgi?id=30794">30794</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing pattern in instcombine
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mehdi.amini@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Instcombine is turning `v < 0x4000000000000000 && v >= -0x4000000000000000`
into `v + 0x4000000000000000 > -1`.

This alone is fine, but is inhibiting other combine. For instance when v is
`sext i32 to i64`, the individual comparison are being folded away:

  icmp sgt i64 (sext i32 %0 to i64 ), -4611686018427387905.

And 

  icmp slt i64  (sext i32 %0 to i64 ), 4611686018427387904

However if the comparison are first combined, we get this pattern:

  %2 = sext i32 %0 to i64
  %3 = add i64 %2, 4611686018427387904

That instcombine does not reduce further.

(See also here:
<a href="http://stackoverflow.com/questions/40203127/why-doesnt-clang-llvm-optimize-this">http://stackoverflow.com/questions/40203127/why-doesnt-clang-llvm-optimize-this</a>
)</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>