[PATCH] D137341: [VectorCombine] widen a load with subvector insert

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 6 06:42:17 PST 2022


spatel added a comment.

In D137341#3910674 <https://reviews.llvm.org/D137341#3910674>, @RKSimon wrote:

> Thanks for looking at this!
>
> How useful/feasible would this be to support inserting into a upper subvector as well?
>
>   define <8 x float> @upper(ptr dereferenceable(32) %x) {
>     %offset = getelementptr inbounds float, ptr %x, i64 4
>     %load = load <4 x float>, ptr %offset, align 4
>     %insert = shufflevector <4 x float> undef, <4 x float> %load, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
>     ret <8 x float> %insert
>   }

I don't have a real example for that, but yes, it's do-able. It would be similar to enhancements that we made in VectorCombine::vectorizeLoadInsert(), so we'd hopefully be able to share some more code for the 2 patterns. We have to (very carefully...) allow peeking through a gep and translating that as a shuffle index offset. I can add a TODO.


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

https://reviews.llvm.org/D137341



More information about the llvm-commits mailing list