[SDAG] try harder to fold casts into vector compare
authorSanjay Patel <spatel@rotateright.com>
Mon, 31 May 2021 11:14:01 +0000 (07:14 -0400)
committerSanjay Patel <spatel@rotateright.com>
Mon, 31 May 2021 11:14:01 +0000 (07:14 -0400)
commit434c8e013a2c3f970df8d79f62491c611534bd5c
tree64516f28e7c0f79a9ed2437ddd58bdeab96f2fc9
parenta723ca32af896d99058672a43fe457ba155a23b2
[SDAG] try harder to fold casts into vector compare

sext (vsetcc X, Y) --> vsetcc (zext X), (zext Y) --
(when the zexts are free and a bunch of other conditions)

We have a couple of similar folds to this already for vector selects,
but this pattern slips through because it is only a setcc.

The tests are based on the motivating case from:
https://llvm.org/PR50055
...but we need extra logic to get that example, so I've left that as
a TODO for now.

Differential Revision: https://reviews.llvm.org/D103280
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/sext-vsetcc.ll