[InstCombine] remove extract-of-select vector transform (2nd try)
authorSanjay Patel <spatel@rotateright.com>
Mon, 25 Sep 2017 20:30:53 +0000 (20:30 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 25 Sep 2017 20:30:53 +0000 (20:30 +0000)
commitecb175608f2c26b4cf728d294ab642a0753e9b27
treef734111d0c3f7a2372dfdef3f54792cddfa61542
parent5e531dfef41bb7cf451481e01552a31c598fdeac
[InstCombine] remove extract-of-select vector transform (2nd try)

The 1st attempt at this:
https://reviews.llvm.org/rL314117
was reverted at:
https://reviews.llvm.org/rL314118

because of bot fails for clang tests that were checking optimized IR. That should be fixed with:
https://reviews.llvm.org/rL314144
...so try again.

Original commit message:

The transform to convert an extract-of-a-select-of-vectors was added at:
https://reviews.llvm.org/rL194013

And a question about the validity of this transform was raised in the review:
https://reviews.llvm.org/D1539:
...but not answered AFAICT>

Most of the motivating cases in that patch are now handled by other combines. These are the tests that were added with
the original commit, but they are not regressing even after we remove the transform in this patch.

The diffs we see after removing this transform cause us to avoid increasing the instruction count, so we don't want to do
those transforms as canonicalizations.

The motivation for not turning a vector-select-of-vectors into a scalar operation is shown in PR33301:
https://bugs.llvm.org/show_bug.cgi?id=33301
...in those cases, we'll get vector ops with this patch rather than the vector/scalar mix that we currently see.

Differential Revision: https://reviews.llvm.org/D38006

llvm-svn: 314147
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/test/Transforms/InstCombine/select-extractelement.ll
llvm/test/Transforms/LoopVectorize/minmax_reduction.ll