[PATCH] D141842: [LoopVectorize] Enable integer Mul and Add as select reduction patterns

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 01:42:59 PST 2023


uabelho added a comment.

In D141842#4081974 <https://reviews.llvm.org/D141842#4081974>, @uabelho wrote:

> Hi,
>
> A heads up that I see a miscompile that I bisected back to this patch. I don't have a reproducer I can share yet but I'm working on it.

I think the miscompile is exposed by this example:

  opt -passes="loop-vectorize" bbi-78206.ll -S -o - -force-vector-width=4

(I'm just using -force-vector-width=4 since VF 4 is what I got for my out of tree target when I saw the miscompile. It's probably not required.)

The input function does a backward search through @table and when it finds an element larger than the input parameter @val, it remembers the index -1 of that element.
Finally it returns the last found index -1.

Ok. With this patch, the vectorizer triggers and it seems like it does not only return _the_ lowest index -1, but in this case it returns the _sum_ of the different "index - 1" for the large enough elements.

So e.g. if @val is 4660 the input function will return 11-1=10.
But with this patch and after vectorization it returns 12-1 + 11-1=21.

F26267482: bbi-78206.ll <https://reviews.llvm.org/F26267482>


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141842/new/

https://reviews.llvm.org/D141842



More information about the llvm-commits mailing list