[LLVMdev] PROPOSAL: struct-access-path aware TBAA

Daniel Berlin dberlin at dberlin.org
Tue Mar 12 20:04:35 PDT 2013


On Tue, Mar 12, 2013 at 7:59 PM, Krzysztof Parzyszek
<kparzysz at codeaurora.org> wrote:
> On 3/12/2013 9:56 PM, Shuxin Yang wrote:
>>
>> Based on my understanding of her design, following is one obtuse
>> motivating example:
>>
>> --------------------------
>> class A;
>> class B;
>>
>> int foo(A* p, B* q) {
>>
>>     p->a_int_field = 2;
>>     q->another_int_field = 3;
>>     return p->a_int_field; // !!!!!
>> }
>> ----------------------------------
>>
>> the *-statement can be optimized into "return 2" if optimizer can prove
>> type-A does not include type-B,
>> and type-B does not include type-A either.
>>
>
> And my example shows that they can alias regardless of that.  Granted, it's
> somewhat contrived and I'm not 100% sure if it's legal.  Once there are
> pointers, there is little that can be done without knowing at least
> something about what they point to.

yes, this is essentially one of my claims :)



More information about the llvm-dev mailing list