[PATCH] D60016: [InstCombine] canonicalize select shuffles by commuting

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 29 15:18:13 PDT 2019


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

In PR41304:
https://bugs.llvm.org/show_bug.cgi?id=41304
...we have a case where we want to fold a binop of select-shuffle (blended) values.

Rather than try to match commuted variants of the pattern, we can canonicalize the shuffles and check for mask equality with commuted operands.

We don't produce arbitrary shuffle masks in instcombine, but select-shuffles are a special case that the backend is required to handle because we already canonicalize vector select to this shuffle form.


https://reviews.llvm.org/D60016

Files:
  clang/test/CodeGen/avx-cmp-builtins.c
  clang/test/CodeGen/avx-shuffle-builtins.c
  llvm/include/llvm/IR/Instructions.h
  llvm/lib/IR/Instructions.cpp
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/test/Transforms/InstCombine/X86/blend_x86.ll
  llvm/test/Transforms/InstCombine/X86/x86-insertps.ll
  llvm/test/Transforms/InstCombine/X86/x86-sse4a.ll
  llvm/test/Transforms/InstCombine/logical-select.ll
  llvm/test/Transforms/InstCombine/phi-select-constant.ll
  llvm/test/Transforms/InstCombine/shuffle_select.ll
  llvm/test/Transforms/InstCombine/vec_demanded_elts.ll
  llvm/test/Transforms/SLPVectorizer/X86/alternate-fp.ll
  llvm/test/Transforms/SLPVectorizer/X86/alternate-int.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60016.192926.patch
Type: text/x-patch
Size: 24479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190329/e040915f/attachment.bin>


More information about the llvm-commits mailing list