[llvm-bugs] [Bug 47136] New: Regression (in LSV?) due to changes in InstCombine

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 12 08:15:44 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47136

            Bug ID: 47136
           Summary: Regression (in LSV?) due to changes in InstCombine
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: bjorn.a.pettersson at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 23845
  --> https://bugs.llvm.org/attachment.cgi?id=23845&action=edit
Reproducer (opt -O3 -load-store-vectorizer qwerty2.ll)

After merging this commit

...
commit 0c1c756a31536666a7b6f5bdb744dbce923a0c9e
Author: Roman Lebedev <lebedev.ri at gmail.com>
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: https://reviews.llvm.org/D85446
...

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
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200812/621c6feb/attachment.html>


More information about the llvm-bugs mailing list