[LLVMdev] PROPOSAL: struct-access-path aware TBAA
Shuxin Yang
shuxin.llvm at gmail.com
Wed Mar 13 11:07:42 PDT 2013
> The program I gave was well typed :)
Hi, Daniel:
Thank you for sharing your insight. I didn't realized it is
well-typed -- I'm basically a big nut of any std.
I'd admit std/spec is one of the most boring material on this planet:-).
So, if I understand correct, your point is:
if a std call a type-casting (could be one which is in
bad-taste:-), TBAA has to respect such std.
If that is strictly true, TBAA has to reply on point-to analysis.
However, that would virtually disable
TBAA as most point-to set has "unknown" element.
Going back to my previous mail,
> In the below example, GCC assumes p and q point to anything because
> they are incoming arguments.
>
>>
>> ------------------------------
>> typedef struct {
>> int x;
>> }T1;
>>
>> typedef struct {
>> int y;
>> }T2;
>>
>> int foo(T1 *p, T2 *q) {
>> p->x = 1;
>> q->y = 4;
>> return p->x;
>> }
>> --------------------------
Yes, gcc should assume p and q point to anything, however, the result
contradict to the assumption --
It promote the p->x expression.
If I fabricate a caller by stealing some code from your previous
example, see bellow.
I think these code & your previous example (about placement new) share
the same std. I'm wondering
if gcc can give a correct result.
foo_caller() {
T1 t1;
T1 *pt1;
T2 *pt2 = new (pt1) T2;
foo(pt1, pt2);
}
More information about the llvm-dev
mailing list