OSDN Git Service

[x86] Fix a bug in my new zext-vector-inreg DAG trickery where we were
authorChandler Carruth <chandlerc@gmail.com>
Wed, 9 Jul 2014 12:36:54 +0000 (12:36 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 9 Jul 2014 12:36:54 +0000 (12:36 +0000)
commit4c27c85cde1657246ad9291af15899f249026bc7
tree35f38bc95815eb597d8a51256f1ffd6567015c83
parentf4fcb0ceab8dfca074b843e00e3528215f6e44f5
[x86] Fix a bug in my new zext-vector-inreg DAG trickery where we were
not widening the input type to the node sufficiently to let the ext take
place in a register.

This would in turn result in a mysterious bitcast assertion failure
downstream. First change here is to add back the helpful assert I had in
an earlier version of the code to catch this immediately.

Next change is to add support to the type legalization to detect when we
have widened the operand either too little or too much (for whatever
reason) and find a size-matched legal vector type to convert it to
first. This can also fail so we get a new fallback path, but that seems
OK.

With this, we no longer crash on vec_cast2.ll when using widening. I've
also added the CHECK lines for the zero-extend cases here. We still need
to support sign-extend and trunc (or something) to get plausible code
for the other two thirds of this test which is one of the regression
tests that showed the most scalarization when widening was
force-enabled. Slowly closing in on widening being a viable legalization
strategy without it resorting to scalarization at every turn. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212614 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
test/CodeGen/X86/vec_cast2.ll