[DAGCombiner] sink target-supported FP<->int cast op after concat vectors
authorSanjay Patel <spatel@rotateright.com>
Wed, 6 May 2020 14:23:43 +0000 (10:23 -0400)
committerSanjay Patel <spatel@rotateright.com>
Wed, 6 May 2020 14:25:58 +0000 (10:25 -0400)
commit2f1fe1864d2516f0f5d818140994caf795ccc9aa
tree2243cf2a3133e23ee5b096499e7b3385cf60f1ea
parentf5f7fd990e0e9c6f786d48d9a6ea832f9d706c1a
[DAGCombiner] sink target-supported FP<->int cast op after concat vectors

Try to combine N short vector cast ops into 1 wide vector cast op:
concat (cast X), (cast Y)... -> cast (concat X, Y...)

This is part of solving PR45794:
https://bugs.llvm.org/show_bug.cgi?id=45794

As noted in the code comment, this is uglier than I was hoping because
the opcode determines whether we pass the source or destination type
to isOperationLegalOrCustom(). Also IIUC, there's no way to validate
what the other (dest or src) type is. Without the extra legality check
on that, there's an ARM regression test in:
test/CodeGen/ARM/isel-v8i32-crash.ll
...that will crash trying to lower an unsupported v8f32 to v8i16.

Differential Revision: https://reviews.llvm.org/D79360
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/avx-shift.ll
llvm/test/CodeGen/X86/concat-cast.ll