[PATCH] D48678: [InstCombine] enhance shuffle-of-binops to allow different variable ops (PR37806)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 27 15:06:04 PDT 2018


spatel created this revision.
spatel added reviewers: lebedev.ri, RKSimon, efriedma.
Herald added a subscriber: mcrosier.

This is an enhancement to https://reviews.llvm.org/D48401 that was discussed in:
https://bugs.llvm.org/show_bug.cgi?id=37806

If we have 2 different variable values, then we shuffle (select) those lanes, shuffle (select) the constants, and then perform the binop. This eliminates a binop.

The new shuffle uses the same shuffle mask as the existing shuffle, so there's no danger of creating a difficult shuffle.

All of the earlier constraints still apply, but we also check for extra uses to avoid creating more instructions than we'll remove.


https://reviews.llvm.org/D48678

Files:
  lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  test/Transforms/InstCombine/shuffle_select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48678.153188.patch
Type: text/x-patch
Size: 17116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180627/0f5fd875/attachment.bin>


More information about the llvm-commits mailing list