[LLVMdev] Making GEP into vector illegal?

Chris Lattner clattner at apple.com
Wed Oct 15 08:22:56 PDT 2008


On Oct 14, 2008, at 11:43 PM, Mike Stump wrote:
> That statement was that:
>
>> float4 a;
>> float* ptr_z = (float*)(&a) + 3;
>
> ``violates strict aliasing``
>
> That assertion is wrong.  The docs says:
>
> @item may_alias
> Accesses to objects with types with this attribute are not subjected  
> to
> type-based alias analysis, but are instead assumed to be able to alias
> any other type of objects, just like the @code{char} type.
>
> clearly, is _m64 is to be treated as char, then, all stores before it
> are complete and no loads can be moved before it, unless you can't
> tell that this happened.  As for what it allows, it allows many
> things, including the original snippet that was said to violate strict
> aliasing.  I can't fathom any other reading, what am I missing?

Aha, gotcha.  I misunderstood the connection.

In any case, the important distinction I wanted to raise was that  
we're talking about how the IR *models a very specific case*, not  
*eliminating a capability* of the IR.

-Chris




More information about the llvm-dev mailing list