<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 - Regression (in LSV?) due to changes in InstCombine"
   href="https://bugs.llvm.org/show_bug.cgi?id=47136">47136</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression (in LSV?) due to changes in InstCombine
          </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>bjorn.a.pettersson@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23845" name="attach_23845" title="Reproducer (opt -O3 -load-store-vectorizer qwerty2.ll)">attachment 23845</a> <a href="attachment.cgi?id=23845&action=edit" title="Reproducer (opt -O3 -load-store-vectorizer qwerty2.ll)">[details]</a></span>
Reproducer (opt -O3 -load-store-vectorizer qwerty2.ll)

After merging this commit

...
commit 0c1c756a31536666a7b6f5bdb744dbce923a0c9e
Author: Roman Lebedev <<a href="mailto:lebedev.ri@gmail.com">lebedev.ri@gmail.com</a>>
Date:   Thu Aug 6 21:10:43 2020 +0300

    [InstCombine] Generalize  %x * (-1<<C)  -->  (-%x) * (1<<C)  fold

    Multiplication is commutative, and either of operands can be negative,
    so if the RHS is a negated power-of-two, we should try to make it
    true power-of-two (which will allow us to turn it into a left-shift),
    by trying to sink the negation down into LHS op.

    But, we shouldn't re-invent the logic for sinking negation,
    let's just use Negator for that.

    Tests and original patch by: Simon Pilgrim @RKSimon!

    Differential Revision: <a href="https://reviews.llvm.org/D85446">https://reviews.llvm.org/D85446</a>
...

we started to see regressions in some of our downstream benchmarks.

When only comparing the result after an "opt -O3" run it the IR difference
isn't that big, so the instcombine rewrite isn't that bad in itself. However,
out target also use the LoadStoreVectorizer (LSV), and to me it seems like the
new code patterns that we get isn't recognized that well by LSV. So instead of
getting two <8 x i16> loads in the vector.body BB we now get four loads.


The qwerty2.ll attachment is a reproducer showing the problem. Reproduce for
example by running:

...
  git co a404acb86af7d62390a2599bb86bba2c5f840f68
  <build>
  opt -O3 -load-store-vectorizer -S qwerty2.ll -o qwerty.a404acb86af7.ll

  git co 0c1c756a31536666a7b6f5bdb744dbce923a0c9e
  <build>
  opt -O3 -load-store-vectorizer -S qwerty2.ll -o qwerty.0c1c756a3153.ll

  diff qwerty.a404acb86af7.ll qwerty.0c1c756a3153.ll
...</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>