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

Shuxin Yang shuxin.llvm at gmail.com
Tue Mar 12 19:56:27 PDT 2013


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.

On 03/12/2013 07:48 PM, Krzysztof Parzyszek wrote:
> On 3/12/2013 9:43 PM, Shuxin Yang wrote:
>>
>> Note that, to make base/offset/size more effective, analyzer need to
>> track the base along the UD chains
>> as far as possible. In this case, the "bases" for the memory are "p",
>> instead of &vd and &vc, respectively.
>
> If the base pointers are the same, then offset+length for each access 
> is sufficient to determine aliasing.  No type information is needed 
> for this.  I'm still not sure exactly what this proposal is supposed 
> to address, but yes---given two base pointers (possibly not equal), 
> the structural paths to the accessed objects are not sufficient.
>
> -Krzysztof
>
>




More information about the llvm-dev mailing list