[llvm-commits] RFC: initial union syntax support

Duncan Sands baldrick at free.fr
Thu May 14 07:48:14 PDT 2009


> This alloca will be aligned to 1 byte, not the maximum alignment of the member 
> types.

you are right, and I don't immediately see a solution to it.  However, if
this is the only problem then there are surely more elementary solutions
than introducing a union type.

> It's also not in the entry block, so SROA won't look at it. (Okay, that can be 
> fixed by using select instead of branch + phi, but will SROA look at 
> variable-size allocas?)

Yes, I should have used a select.

If you know the sizes of the types then the size expression will be constant
folded to a simple integer constant, and sroa can do its stuff.  If you don't
know the sizes of the types then sroa wouldn't be able to do anything in the
case of the proposed union type either.



More information about the llvm-commits mailing list