[InstCombine] try to reduce shuffle with bitcasted operand
authorSanjay Patel <spatel@rotateright.com>
Thu, 2 Apr 2020 17:44:50 +0000 (13:44 -0400)
committerSanjay Patel <spatel@rotateright.com>
Thu, 2 Apr 2020 17:44:50 +0000 (13:44 -0400)
commitf4448063ccf1c2eda518ad326018276baff870d2
tree5f70bc124b54050193f82b04fb9b0021da5d1158
parentb6050ca181684997d0284ca39a78adc6833ddfc4
[InstCombine] try to reduce shuffle with bitcasted operand

shuf (bitcast X), undef, Mask --> bitcast X'

The 'inverse shuffles' test (shuf_bitcast_operand) is a pattern
in the motivating examples from PR35454:
https://bugs.llvm.org/show_bug.cgi?id=35454
(see also D76727)

We can deal with this class of patterns in generic instcombine
because we are not creating any new shuffles, just a bitcast.

Alive2 proof:
http://volta.cs.utah.edu:8080/z/mwDUZf

Differential Revision: https://reviews.llvm.org/D76844
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/test/Transforms/InstCombine/shufflevec-bitcast.ll