<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] Negation not sunk through shift"
   href="https://bugs.llvm.org/show_bug.cgi?id=44529">44529</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InstCombine] Negation not sunk through shift
          </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>nikita.ppv@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>define i64 @test(i64 %a, i64 %b) {
  %sub = sub i64 %a, %b
  %mul = shl i64 %sub, 2
  %neg = sub i64 0, %mul
  ret i64 %neg
}

is not instcombined to

define i64 @test(i64 %a, i64 %b) {
  %sub2 = sub i64 %b, %a
  %neg = shl i64 %sub2, 2
  ret i64 %neg
}

This pattern showed up as a regression when testing some instcombine worklist
order changes.

I guess the most general case of this would be handled by the negator in
<a href="https://reviews.llvm.org/D68408">https://reviews.llvm.org/D68408</a>, though a much smaller gun would do in this
case as well.</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>