OSDN Git Service

[InstCombine] canonicalize (bitcast (extractelement X)) --> (extractelement(bitcast X))
authorSanjay Patel <spatel@rotateright.com>
Sat, 12 Dec 2015 16:44:48 +0000 (16:44 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sat, 12 Dec 2015 16:44:48 +0000 (16:44 +0000)
commit3720185c2869c146a5e889e05f4e62cee3dc314d
treefa5580453f6e9b05020f90c355474f6e6b2a9ec0
parentd7f7b7e355cc39b40235ac71bf4a41dce2c0a036
[InstCombine] canonicalize (bitcast (extractelement X)) --> (extractelement(bitcast X))

This change was discussed in D15392. It allows us to remove the fold that was added
in:
http://reviews.llvm.org/r255261

...and it will allow us to generalize this fold:
http://reviews.llvm.org/rL112232

while preserving the order of bitcast + extract that it produces and testing shows
is better handled by the backend.

Note that the existing check for "isVectorTy()" wasn't strong enough in general
and specifically because: x86_mmx. It's not a vector, but it's not vectorizable
either. So here we check VectorType::isValidElementType() directly before
proceeding with the transform.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255433 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCasts.cpp
test/Transforms/InstCombine/bitcast-vec-canon.ll