[clang] [llvm] [SROA] Vector promote some memsets (PR #133301)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 07:24:41 PDT 2025


macurtis-amd wrote:

I should preface this by mentioning that I'm not all that familiar with SROA, so thank you for your patience.

> So if I understand correctly, you are marking memsets as unsplittable, lowering them to vector zero and smaller accesses to inserts/extracts.
>

Yes. As a naive attempt to produce the desired result, I was merely trying to mimic the behavior of `store` (see https://godbolt.org/z/G9f4vPhs6).

> I don't think your general approach here is going to work. We need to be careful about introducing vector operations out of thin air, because LLVM is not going to second guess them. If you convert a memset to <32768 x i8> ops here, LLVM is going to carry those all they down, even though this is almost certainly not performant. Additionally, you are breaking the ability for SROA to split the alloca and fully promote parts of it.

Is there an appropriate place in the code to decide if a splittable memset should be promoted to a vector operation?


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


More information about the llvm-commits mailing list