[PATCH] D100717: [InstCombine] Transform memcpy to ptr load/stores if TBAA says so

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 23 10:38:07 PDT 2021


aqjune added a comment.

In D100717#2712186 <https://reviews.llvm.org/D100717#2712186>, @jeroen.dobbelaere wrote:

> - The testcase tries out a p64:64:64 and a p32:32:32 case, assuming that the p32:32:32 case should use a i64. Is this indeed the expected lowering ? Or would we expect two pointer load/stores ?

I found that the test case was indeed bogus a bit; the corresponding `!tbaa_struct` has one pointer field, so it is 4 bytes, but the memcpy was copying 8 bytes.
I made a separate test (`memcpy-tbaa32.ll`) that copies 4 bytes only.

> - When I try out a struct with single pointer fields and array pointer fields, I see that clang produces separate pointer fields for the single pointers and a large 'char' field for the array of pointers. (See https://www.godbolt.org/z/PT3qorvnq ) Maybe that is something that could be changed later in a pointer field with a larger size ?

This is interesting, the `!tbaa_struct` is using char. I also think using a pointer type is totally fine in this case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100717



More information about the llvm-commits mailing list