<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] try to thread binop through select-of-constants"
   href="https://bugs.llvm.org/show_bug.cgi?id=52406">52406</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InstCombine] try to thread binop through select-of-constants
          </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>Forking this off from <a class="bz_bug_link 
          bz_status_CONFIRMED "
   title="CONFIRMED - [InstCombine] fold multiply and equality compare with constant"
   href="show_bug.cgi?id=52402">bug 52402</a> (it doesn't involve multiplication magic):

define i8 @src(i8 %x, i1 %b) {
  %t4 = and i8 %x, 8
  %t7 = select i1 %b, i8 7, i8 0
  %t8 = shl i8 %t4, %t7
  ret i8 %t8
}

define i8 @tgt(i8 %x, i1 %b) {
  %t4 = and i8 %x, 8
  %r = select i1 %b, i8 0, i8 %t4
  ret i8 %r
}

<a href="https://alive2.llvm.org/ce/z/zw2px6">https://alive2.llvm.org/ce/z/zw2px6</a>

It probably does not make sense in general to pull the binop into the select -
we need to be able to simplify both sides of the select to justify this. This
might involve checking if one of the select operands is an identity constant
(ConstantExpr::getBinOpIdentity).</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>