[PATCH] D43367: [X86] Turn selects with constant condition into vector shuffles during DAG combine

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 18:47:55 PST 2018

craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon.

Currently we convert to shuffles during lowering. This moves it to DAG combine so hopefully we can get it done before type legalization has to extend the condition.

I believe in some cases we're creating SHRUNKBLENDs that end up with constant conditions because we see the extended on the condition and think its a dynamic selelect before DAG combine gets a chance to constant fold the extend. We could add combines to turn SHRUNKBLENDs with constant condition back to vselect. But it seemed like it might be better to just send them to shuffles as early as possible so they never get a chance to become SHRUNKBLENDs. This the reason some tests went from blends controlled by a constant pool load to just move.

Some of the constant pool entries changed because the sign_extend introduced by type legalization turned undef elements in select condition into 0s. While the select->shuffle used -1 in the shuffle mask. So now the shuffle lowering can do what it wants with them.

I'll remove the lowering code as a follow up. We might be able to simplify some of the pre-checks for SHRUNKBLEND as the FIXME there says.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43367.134543.patch
Type: text/x-patch
Size: 14811 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180216/81ee822b/attachment.bin>

More information about the llvm-commits mailing list