[PATCH] D32620: [DAGCombiner] shrink/widen a vselect to match its condition operand size (PR14657)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 27 15:53:37 PDT 2017
spatel created this revision.
Herald added subscribers: mcrosier, rengolin, aemerson.
We discussed shrinking/widening of selects in IR in https://reviews.llvm.org/D26556, and I'll try to get back to that patch eventually. But I'm hoping that this transform is less iffy in the DAG where we can check legality of the select that we want to produce.
A few things to note:
1. We can't wait until after legalization and do this generically because (at least in the x86 tests from PR14657), we'll have PACKSS and bitcasts in the pattern.
2. This might benefit more of the SSE codegen if we lifted the legal-or-custom requirement, but I think that requires a closer look to make sure we don't end up worse.
3. There's a 'vblendv' opportunity that we're missing that results in andn/and/or in some cases. I thought I'd better just post this as-is to make sure I'm not off the rails, but I could fix that first.
4. I'm assuming that AVX1 offers the worst of all worlds wrt uneven ISA support with multiple legal vector sizes, but I can certainly add tests for other targets to make sure this isn't doing harm.
5. There's a codegen miracle in the multi-BB tests from PR14657 (the gcc auto-vectorization tests): despite IR that is terrible for the target, this patch allows us to generate the optimal loop code because something post-ISEL is hoisting the splat extends above the vector loops.
https://reviews.llvm.org/D32620
Files:
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/cast-vsel.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32620.97005.patch
Type: text/x-patch
Size: 18296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170427/75c37a89/attachment.bin>
More information about the llvm-commits
mailing list