[LLVMdev] Overzealous PromoteCastOfAllocation

Dan Gohman gohman at apple.com
Wed Sep 17 16:48:01 PDT 2008


On Sep 13, 2008, at 1:07 PM, Matthijs Kooijman wrote:
>
>> 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?


I haven't studied the code you're talking about in detail. I was
just observing that the compiler allocates the storage for alloca,
so it can use whatever alignment it wants, so it makes sense to
use the greatest value that any of the users would want.

Dan




More information about the llvm-dev mailing list