[PATCH] D107574: [GlobalOpt] [MemoryBuiltins] Update getMallocType with bitcast on stored pointer

Shimin Cui via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 6 08:29:57 PDT 2021


scui added a comment.

In D107574#2929921 <https://reviews.llvm.org/D107574#2929921>, @efriedma wrote:

> In D107574#2929796 <https://reviews.llvm.org/D107574#2929796>, @scui wrote:
>
>> It looks to me the IR code will be sub-optimal for some cases if we simply return Type i8* for getMallocType.
>
> Will it?  Almost all optimizations can deal with bitcasts of global variables without getting confused.

I could be wrong. One case I can imagine is to set initial value, for example, an i32 value for [4 x i8] global.

> Anyway, if you want to refine the type of the global created by the transform, I guess that's okay, but confusion about the types involved shouldn't ever block the transform.

I'm also confused with the nullptr return with the existing code. I'll try another version to limit to looking into only the store from the malloc call, and see if that will make more sense.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107574



More information about the llvm-commits mailing list