[PATCH] D88788: [SROA] rewritePartition()/findCommonType(): if uses have conflicting type, try getTypePartition() before falling back to largest integral use type (PR47592)

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 03:17:28 PDT 2020


nlopes added a comment.

In D88788#2311004 <https://reviews.llvm.org/D88788#2311004>, @efriedma wrote:

> I guess if we're relying on the allocated type of the alloca anyway, preferring it over an integer type isn't terrible.
>
> Really, though, we should avoid relying on the allocated type where possible.  Here, we could check if any of the load/store operations use a pointer type, and choose a pointer type in that case.

Agreed. But until LLVM removes pointer sub-types it's convenient to get the alloca type right to avoid bitcast on every access anyway.
When pointer sub-types goes away, I guess all this code in SROA to find the right type for alloca would go away, but as you say it would have to be replaced with code to get the right load/store type instead. (FWIW Alive2's alloca only takes the number of bytes to allocate as argument)
So I see this patch as a step in the right direction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88788



More information about the llvm-commits mailing list