[SLP]Fix a crash when insert subvector is out of range.
authorAlexey Bataev <a.bataev@outlook.com>
Fri, 17 Jun 2022 17:23:12 +0000 (10:23 -0700)
committerAlexey Bataev <a.bataev@outlook.com>
Tue, 21 Jun 2022 14:16:35 +0000 (07:16 -0700)
commitf1ee2738b3d70fea803ac1f3401c2fc9f61e514a
tree59e04e81a8b09b7dc54bd7012a797e089ae88a62
parentac4cb1775b8f40be2809245b818993a576639c1f
[SLP]Fix a crash when insert subvector is out of range.

If the OffsetBeg + InsertVecSz is greater than VecSz, need to estimate
the cost as shuffle of 2 vector, not as insert of subvector. Otherwise,
the inserted subvector is out of range and compiler may crash.

Differential Revision: https://reviews.llvm.org/D128071
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/AArch64/buildvector-vectorize.ll [new file with mode: 0644]