[PATCH] D81013: [InstCombine] move vector select ahead of select-shuffle

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 09:52:46 PDT 2020


spatel created this revision.
spatel added reviewers: efriedma, lebedev.ri, RKSimon, nlopes, nikic, craig.topper.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

select Cond, (shuf_sel X, Y), X --> shuf_sel X, (select Cond, Y, X)

A select of a select-shuffle ("blend" in x86 lingo) can be reversed so that the select is done first. 
This is a more limited version of what I was trying in D80658 <https://reviews.llvm.org/D80658>, but it enables existing demanded bits transforms to catch some of the motivating cases. The tricky bit in that seems to be that by moving the shuffle later, we can always guarantee that poison is correctly inhibited by the shuffle mask in the final value.

Alive2 checks for the basic tests:
http://volta.cs.utah.edu:8080/z/Qqd3RK
http://volta.cs.utah.edu:8080/z/S4wchM
http://volta.cs.utah.edu:8080/z/wf9zPL
http://volta.cs.utah.edu:8080/z/wJeEGk


https://reviews.llvm.org/D81013

Files:
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  llvm/test/Transforms/InstCombine/select-select.ll
  llvm/test/Transforms/InstCombine/vec_demanded_elts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81013.267906.patch
Type: text/x-patch
Size: 9735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200602/483f701b/attachment.bin>


More information about the llvm-commits mailing list