[llvm] [SLP]Add subvector vectorization for non-load nodes (PR #108430)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 13:17:37 PDT 2024


alexey-bataev wrote:

> here's a diff of the relevant function after slp-vectorizer with and without this patch reverted, and with inst names all set to `%0` for minimal diffing purposes. I'll keep digging, but perhaps you can see something from this diff?
> 
> ```
> 177a178,181
> >   %0 = insertelement <2 x i32> poison, i32 %lshr166, i32 0
> >   %0 = insertelement <2 x i32> %0, i32 %trunc176, i32 1
> >   %0 = and <2 x i32> %0, <i32 255, i32 255>
> >   %0 = icmp eq <2 x i32> %0, zeroinitializer
> 188,194c192
> <   %0 = insertelement <2 x i32> poison, i32 %lshr166, i32 0
> <   %0 = insertelement <2 x i32> %0, i32 %trunc176, i32 1
> <   %0 = and <2 x i32> %0, <i32 255, i32 255>
> <   %0 = icmp eq <2 x i32> %0, zeroinitializer
> <   %0 = zext <2 x i8> %0 to <2 x i32>
> <   %0 = shufflevector <2 x i32> %0, <2 x i32> %0, <8 x i32> <i32 poison, i32 poison, i32 0, i32 1, i32 poison, i32 poison, i32 2, i32 3>
> <   %0 = insertelement <8 x i32> %0, i32 %trunc111, i32 0
> ---
> >   %0 = insertelement <8 x i32> poison, i32 %trunc111, i32 0
> 197a196,199
> >   %0 = shufflevector <2 x i32> %0, <2 x i32> poison, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
> >   %0 = shufflevector <8 x i32> %0, <8 x i32> %0, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 4, i32 5, i32 8, i32 9>
> >   %0 = sext <2 x i8> %0 to <2 x i32>
> >   %0 = call <8 x i32> @llvm.vector.insert.v8i32.v2i32(<8 x i32> %0, <2 x i32> %0, i64 2)
> 204a207,208
> >   %0 = shufflevector <2 x i1> %0, <2 x i1> poison, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
> >   %0 = shufflevector <8 x i1> %0, <8 x i1> %0, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 4, i32 5, i32 8, i32 9>
> 206d209
> <   %0 = call <8 x i1> @llvm.vector.insert.v8i1.v2i1(<8 x i1> %0, <2 x i1> %0, i64 6)
> 238c241,243
> <   %0 = call <8 x i64> @llvm.vector.insert.v8i64.v4i64(<8 x i64> poison, <4 x i64> %0, i64 0)
> ---
> >   %0 = shufflevector <2 x i64> %0, <2 x i64> poison, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
> >   %0 = shufflevector <8 x i64> %0, <8 x i64> poison, <8 x i32> <i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 0, i32 1>
> >   %0 = call <8 x i64> @llvm.vector.insert.v8i64.v4i64(<8 x i64> %0, <4 x i64> %0, i64 0)
> 240d244
> <   %0 = call <8 x i64> @llvm.vector.insert.v8i64.v2i64(<8 x i64> %0, <2 x i64> %0, i64 6)
> ```

Hmm, hard to tell, but the only significant difference I see is zext/sext

https://github.com/llvm/llvm-project/pull/108430


More information about the llvm-commits mailing list