OSDN Git Service

[SelectionDAG] When scalarizing trunc, don't assert for legal operands.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 30 Oct 2014 23:46:50 +0000 (23:46 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 30 Oct 2014 23:46:50 +0000 (23:46 +0000)
commit107d77958d8b849e486fc73805ecfc27039b509d
tree6000d7e554b6bd0aaa1dca8cf659c4cda2106371
parent9eb0a097109c5b6e7ccac010d9bd7e5e2129c041
[SelectionDAG] When scalarizing trunc, don't assert for legal operands.

r212242 introduced a legalizer hook, originally to let AArch64 widen
v1i{32,16,8} rather than scalarize, because the legalizer expected, when
scalarizing the result of a conversion operation, to already have
scalarized the operands.  On AArch64, v1i64 is legal, so that commit
ensured operations such as v1i32 = trunc v1i64 wouldn't assert.

It did that by choosing to widen v1 types whenever possible.  However,
v1i1 types, for which there's no legal widened type, would still trigger
the assert.

This commit fixes that, by only scalarizing a trunc's result when the
operand has already been scalarized, and introducing an extract_elt
otherwise.
This is similar to r205625.

Fixes PR20777.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220937 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
test/CodeGen/AArch64/trunc-v1i64.ll