[LLVMdev] Overzealous PromoteCastOfAllocation

Matthijs Kooijman matthijs at stdin.nl
Sat Sep 13 13:07:16 PDT 2008


Hi Dan,

> Changing PromoteCastOfAllocation to not replace aggregate allocas with
> non-aggregate allocas if they have GEP users sounds reasonable to me.
This sounds reasonable indeed, but still a bit arbitrary. Haven't figured out
anything better yet, though.

> Finding the maximum alignment is sometimes still useful though, so
> it would be nice to update the alignment field of the alloca even if
> its type is left unchanged.
The maximizing of the alignment is done only looking at the type's ABI
alignment, the actual alignment of the alloca instruction is not used.

But what you suggest is that if the alloca is casted to some type that has
higher alignment, you want that higher allignment propagated to the alloca
instruction? I can see why this is useful, since bitcasting to a type with
higher alignment can actually produce invalid code, I think? Or how does this
work exactly?

Gr.

Matthijs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080913/a7cc8e2c/attachment.sig>


More information about the llvm-dev mailing list