[PATCH] D119623: [SLP] Simplify indices processing for insertelements

Anton Afanasyev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 13 00:40:09 PST 2022


anton-afanasyev added a comment.

In D119623#3316827 <https://reviews.llvm.org/D119623#3316827>, @ABataev wrote:

> What kind of bugs do you see with these test cases and current version of the function? I would try to keep it, better to generate UndefMaskElem if possible, rather than cut of the vectorization early.

All these test cases are crashing without patch. There are several issues with this code. First of all, see lines 4028 and 4053 -- we use already dereferenced `Optional<int> Idx = *getInsertIndex(V);` (it should be without `*`). Also `MinIdx` is computed but not used at all.

But the main problem is that `UndefMaskElem` generally makes no sense for index: the function `getInsertIndex()` returns _index_ rather than element, if it is undef/poison/out of range then whole vector is poison. Also this return value `UndefMaskElem` isn't used now anywhere, if somehow (how?) it could be useful in future, it can be added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119623



More information about the llvm-commits mailing list