[SLP]Fix PR61018: Assertion `Mask[I] == UndefMaskElem && "Multiple uses
authorAlexey Bataev <a.bataev@outlook.com>
Mon, 27 Feb 2023 17:20:49 +0000 (09:20 -0800)
committerAlexey Bataev <a.bataev@outlook.com>
Mon, 27 Feb 2023 18:09:48 +0000 (10:09 -0800)
commit007177bdde60a822ccaefc96593e818c2235e2d5
tree57475b4feff0b91859764d7772dc96b2802e36d0
parentd514726d31323074e620c7f7f6a07eab4f4e3c27
[SLP]Fix PR61018: Assertion `Mask[I] == UndefMaskElem && "Multiple uses
of scalars."' failed.

Need to check for the reused indices when checking if 2 insertelement
instruction are from the same buildvector. If the inidices are reused,
better not to match buildvectors and consider them as differenet,
otherwise need to track the order of insertelement operations.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/insertelements-with-reused-indices.ll [new file with mode: 0644]