[PATCH] [CodeGen] Combine shuffle from concat+bitcast scalar to avoid the smaller vector type.

Ahmed Bougacha ahmed.bougacha at gmail.com
Wed Apr 8 18:43:51 PDT 2015


In http://reviews.llvm.org/D8884#153454, @RKSimon wrote:

> In http://reviews.llvm.org/D8884#153312, @ab wrote:
>
> > Yes, but there's other combines that can get in the way.  For instance, my go-to example is the _dup testcase, which we'll try to turn into just (concat_vectors (bitcast (i16)), (bitcast (i16)), ...), which, when promoted, gets scalarized, and we never recover from that.  On X86 we do, that's the part I still need to look into.
>
>
> Have you looked at generalizing the visitCONCAT_VECTOR code to create SCALAR_TO_VECTOR or BUILD_VECTOR depending on the contents of the operands? At the moment the SCALAR_TO_VECTOR and BUILD_VECTOR cases are treated separately but it should be pretty easy to merge - see http://reviews.llvm.org/D7816.


Now that I look at this again, it seems to me that for the concat problem, a cleaner solution would be to combine (only when the intermediate type is illegal, perhaps?):

  (v8i8 concat_vectors (v2i8 bitcast (i16)) x4)

into:

  (v8i8 (bitcast (v4i16 BUILD_VECTOR (i16) x4)))

Is that what you're proposing?

-Ahmed


http://reviews.llvm.org/D8884

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list