[InstCombine] Fix assert condition in `foldSelectShuffleOfSelectShuffle`
authorNabeel Omer <nabeel.omer@sony.com>
Thu, 20 Oct 2022 12:06:01 +0000 (12:06 +0000)
committerNabeel Omer <nabeel.omer@sony.com>
Thu, 20 Oct 2022 12:10:54 +0000 (12:10 +0000)
commite1fd6d49a3dfa59b4be85102a866a2068fa4760a
tree42311c0cf33c474280e877b6a1fd5e973381750b
parentab045561eeb713d30c15271d57533bf27a60fcf8
[InstCombine] Fix assert condition in `foldSelectShuffleOfSelectShuffle`

Bug introduced in e239198cdbbf.

The assert() is making an assumption that the resulting shuffle mask
will always select elements from both vectors, this is untrue in the
case of two shuffles being folded if the former shuffle has a mask with
undef elements in it. In such a case folding the shuffles might result
in a mask which only selects from one of the vectors because the other
elements (in the mask) are undef.

Differential Revision: https://reviews.llvm.org/D136256
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/test/Transforms/InstCombine/shuffle_select.ll