[PATCH] D62024: [InstCombine] fold shuffles of insert_subvectors

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 14:57:23 PDT 2019


spatel added a comment.

In D62024#1509044 <https://reviews.llvm.org/D62024#1509044>, @efriedma wrote:

> I tried llc with the before/after of the  `<7 x i8>` testcase from the patch on x86-64, and I'm seeing different shuffles.  I'm not sure why, though; the type v9i8 is involved for some non-obvious reason. Full testcase:
>
>   define <7 x i8> @insert_subvector_shuffles(<3 x i8> %x, <3 x i8> %y) {
>     %s1 = shufflevector <3 x i8> %x, <3 x i8> undef, <7 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
>     %s2 = shufflevector <3 x i8> %y, <3 x i8> undef, <7 x i32> <i32 undef, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef>
>     %s3 = shufflevector <7 x i8> %s1, <7 x i8> %s2, <7 x i32> <i32 0, i32 8, i32 1, i32 undef, i32 8, i32 1, i32 9>
>     ret <7 x i8> %s3
>   }
>   define <7 x i8> @insert_subvector_shuffles2(<3 x i8> %x, <3 x i8> %y) {
>     %s3 = shufflevector <3 x i8> %x, <3 x i8> %y, <7 x i32> <i32 0, i32 4, i32 1, i32 undef, i32 4, i32 1, i32 5>
>     ret <7 x i8> %s3
>   }
>


That's bizarre. We use "alignTo(7, 3)":

  /// Returns the next integer (mod 2**64) that is greater than or equal to
  /// \p Value and is a multiple of \p Align. \p Align must be non-zero.

But for the purposes of this transform, we don't have to worry about weird types, right? We get to assume that the destination type (the original wide shuffle type) was intentionally created in source or was validated by TTI in the vectorizers.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62024/new/

https://reviews.llvm.org/D62024





More information about the llvm-commits mailing list