[CodeGen] Combine concat_vector of trunc'd scalar to scalar_to_vector.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 9 Apr 2015 20:04:47 +0000 (20:04 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 9 Apr 2015 20:04:47 +0000 (20:04 +0000)
commit66649e00c91e30fdfc8dd64b43cde2632a831138
treed7433ee60fe2bcf357018aab98192a359502aaec
parent117bf240ef0fdb7646f4c3ccc88e8ff504bbac26
[CodeGen] Combine concat_vector of trunc'd scalar to scalar_to_vector.

We already do:
  concat_vectors(scalar, undef) -> scalar_to_vector(scalar)
When the scalar is legal.
When it's not, but is a truncated legal scalar, we can also do:
  concat_vectors(trunc(scalar), undef) -> scalar_to_vector(scalar)
Which is equivalent, since the upper lanes are undef anyway.
While there, teach the combine to look at more than 2 operands.

Differential Revision: http://reviews.llvm.org/D8883

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234530 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/AArch64/concat_vector-truncate-combine.ll
test/CodeGen/AArch64/concat_vector-truncated-scalar-combine.ll [new file with mode: 0644]