[all-commits] [llvm/llvm-project] b6050c: [VectorCombine] transform bitcasted shuffle to nar...

RotateRight via All-commits all-commits at lists.llvm.org
Thu Apr 2 10:30:28 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b6050ca181684997d0284ca39a78adc6833ddfc4
      https://github.com/llvm/llvm-project/commit/b6050ca181684997d0284ca39a78adc6833ddfc4
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-04-02 (Thu, 02 Apr 2020)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/VectorCombine.cpp
    M llvm/test/Transforms/VectorCombine/X86/shuffle.ll

  Log Message:
  -----------
  [VectorCombine] transform bitcasted shuffle to narrower elements

bitcast (shuf V, MaskC) --> shuf (bitcast V), MaskC'

We do not attempt this in InstCombine because we do not want to change
types and create new shuffle ops that are potentially not lowered as
well as the original code. Here, we can check the cost model to see if
it is worthwhile.

I've aggressively enabled this transform even if the types are the same
size and/or equal cost because moving the bitcast allows InstCombine to
make further simplifications.

In the motivating cases from PR35454:
https://bugs.llvm.org/show_bug.cgi?id=35454
...this is enough to let instcombine and the backend eliminate the
redundant shuffles, but we probably want to extend VectorCombine to
handle the inverse pattern (shuffle-of-bitcast) to get that
simplification directly in IR.

Differential Revision: https://reviews.llvm.org/D76727




More information about the All-commits mailing list