[LLVMdev] tbaa

liyi at cs.toronto.edu liyi at cs.toronto.edu
Fri Dec 2 14:14:44 PST 2011


Why not try some simple ones like:

  1 void foo(int);
  2
  3 int main()
  4 {
  5   int x=0;
  6   int* p=&x;
  7   int* q=&x;
  8
  9   float z=0;
 10   float* t=&z;
 11
 12   return *p;
 13 }

-tbaa gives me:
Alias Set Tracker: 1 alias sets for 7 pointer values.
  AliasSet[0x207f860, 7] may alias, Mod/Ref   Pointers: (i32* %1, 4),
(i32* %x, 4), (i32** %p, 8), (i32** %q, 8), (float* %z, 4), (float** %t,
8), (i32* %2, 4)

===== Alias Analysis Evaluator Report =====
  21 Total Alias Queries Performed
  0 no alias responses (0.0%)
  21 may alias responses (100.0%)
  0 partial alias responses (0.0%)
  0 must alias responses (0.0%)
  Alias Analysis Evaluator Pointer Alias Summary: 0%/100%/0%/0%
  Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!

-basicaa gives me:
Alias Set Tracker: 6 alias sets for 7 pointer values.
  AliasSet[0x27a0020, 1] must alias, Mod       Pointers: (i32* %1, 4)
  AliasSet[0x27a0080, 2] may alias, Mod/Ref   Pointers: (i32* %x, 4),
(i32* %2, 4)
  AliasSet[0x27a00e0, 1] must alias, Mod/Ref   Pointers: (i32** %p, 8)
  AliasSet[0x27a3f60, 1] must alias, Mod       Pointers: (i32** %q, 8)
  AliasSet[0x27a4000, 1] must alias, Mod       Pointers: (float* %z, 4)
  AliasSet[0x27acdf0, 1] must alias, Mod       Pointers: (float** %t, 8)

===== Alias Analysis Evaluator Report =====
  21 Total Alias Queries Performed
  19 no alias responses (90.4%)
  2 may alias responses (9.5%)
  0 partial alias responses (0.0%)
  0 must alias responses (0.0%)
  Alias Analysis Evaluator Pointer Alias Summary: 90%/9%/0%/0%
  Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!

So I suspect -tbaa is not working in this case.

> Can you post the source code of your test case?
>
> Gan
>
>
> On Fri, Dec 2, 2011 at 1:44 PM,  <liyi at cs.toronto.edu> wrote:
>> Hi,
>>
>> Could anyone tell me how exactly do I use "Type Based Alias Analysis"?
>>
>> I compiled the C program with Clang, and verified that there is tbaa
>> metadata in the IR code.
>>
>> But then when I use "opt -tbaa input.c.bc -aa-eval" to check the
>> results,
>> it always gives 100% may aliasing no matter what input.
>>
>> Am I using "tbaa" correctly?
>>
>> Thanks.
>> Yi
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
> --
> Best Regards
>
> Gan
>





More information about the llvm-dev mailing list