[VectorCombine] Add special handling for truncating shuffles (#70013)
commit8e31acf8ca0db5e6160d85e266432f78148d38f5
authorNabeel Omer <nabeel.omer@sony.com>
Tue, 24 Oct 2023 14:03:43 +0000 (24 15:03 +0100)
committerGitHub <noreply@github.com>
Tue, 24 Oct 2023 14:03:43 +0000 (24 15:03 +0100)
treebe20eae7824fe5c55937999ed9248c3c18456e69
parent254558ac53e7d5c14b73f38d9ddb2272ececcbd6
[VectorCombine] Add special handling for truncating shuffles (#70013)

When dealing with a truncating shuffle, we can end up in a situation
where the type passed to getShuffleCost is the type of the result of the
shuffle, and the mask references an element which is out of bounds of
the result vector.

If dealing with truncating shuffles, pass the type of the input vectors
to `getShuffleCost()` in order to avoid an out-of-bounds assertion.
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
llvm/test/Transforms/VectorCombine/X86/reduction-two-vecs-combine.ll