[PATCH] D98240: [VectorCombine] Simplify to scalar store if only one element updated

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 26 01:14:09 PDT 2021


fhahn added a comment.

In D98240#2781048 <https://reviews.llvm.org/D98240#2781048>, @hgreving wrote:

> For targets not supporting scalar load from vector memory (like ours), this breaks it:
>
>   %43 = load <8 x i32>, <8 x i32> addrspace(201)* %1, align 32, !tbaa !28
>   %44 = extractelement <8 x i32> %43, i32 0
>
> Now:
>
>   %43 = getelementptr inbounds <8 x i32>, <8 x i32> addrspace(201)* %1, i32 0, i32 0
>   %44 = load i32, i32 addrspace(201)* %43, align 32
>
> Are targets expected to provide patterns?

Interesting! I guess the code assumes that a scalar load is always possible & at least as cheap as the vector version. But I think it would make sense to ask the cost-model if that's the case. Not sure if it would be possible to test this with an in-tree target?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98240



More information about the llvm-commits mailing list