[SLP]Fix the crash on cost calculation if non-compatible vectors shuffled.
authorAlexey Bataev <a.bataev@outlook.com>
Wed, 28 Apr 2021 14:02:33 +0000 (07:02 -0700)
committerAlexey Bataev <a.bataev@outlook.com>
Fri, 30 Apr 2021 16:34:20 +0000 (09:34 -0700)
commita3fd82c289878e1a8fa5833d87b688cd50624247
treea18883ef13f70109b91378c694e191c5cfd976c7
parent936c777e2bf86cd78b532c1331c4f7ee90b95383
[SLP]Fix the crash on cost calculation if non-compatible vectors shuffled.

If the extracts from the non-power-2 vectors are recognized as shuffles,
need some extra checks to not crash cost calculations if trying to gext
the ecost for subvector extracts. In this case need to check carefully
that we do not exit out of bounds of the original vector, otherwise the
TTI's cost model will crash on assert.

Differential Revision: https://reviews.llvm.org/D101477
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/AMDGPU/crash_extract_subvector_cost.ll [new file with mode: 0644]