[LLVMdev] PROPOSAL: struct-access-path aware TBAA
Krzysztof Parzyszek
kparzysz at codeaurora.org
Tue Mar 12 19:59:59 PDT 2013
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.
-Krzysztof
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev
mailing list