<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] Failure to simplify 2 icmp and select after rL369840"
   href="https://bugs.llvm.org/show_bug.cgi?id=43261">43261</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InstCombine] Failure to simplify 2 icmp and select after rL369840
          </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>denis.bakhvalov@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Before rL369840 we simplified the following case:

  %tmp = add i32 %i, -3
  %tmp1 = icmp ult i32 %tmp, 2
  %cmp2 = icmp eq i32 %i, 5
  %phitmp = zext i1 %cmp2 to i32
  %tmp2 = select i1 %tmp1, i32 1, i32 %phitmp

to

  %tmp = add i32 %i, -3
  %0 = icmp ult i32 %tmp, 3
  %tmp2 = zext i1 %0 to i32

Proof: <a href="https://rise4fun.com/Alive/dhoe">https://rise4fun.com/Alive/dhoe</a>

There were 4 steps of simplification:
step1&2: <a href="https://rise4fun.com/Alive/82o">https://rise4fun.com/Alive/82o</a>
step3&4: <a href="https://rise4fun.com/Alive/Izp">https://rise4fun.com/Alive/Izp</a>

After rL369840 we invert the first comparison (icmp ult -> ugt, as a result of
tryToReuseConstantFromSelectInComparison() ) and instcombine takes another
route.

I'm not sure if it is a duplicate of recently created bug for InstCombine.</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>