[llvm-dev] TBAA falsely reporting may alias?

Kavon Farvardin via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 13 11:31:01 PDT 2017


I'm trying to work with Type Based Alias Analysis (TBAA). Here's the example program I'm working with:


define void @foo(i64* %a, i64* %b, i64 %x, i64 %y) {
	store i64 %x, i64* %a, !tbaa !2  ; write to stack
	store i64 %y, i64* %b, !tbaa !3  ; write to heap
	ret void

!1 = !{!"root"}
!2 = !{!"stack", !1}
!3 = !{!"heap", !1}


When I run:  opt -disable-output -disable-basicaa -tbaa -aa-eval -print-alias-sets simple_tbaa.ll

I get something unusual, as the two pointers %a and %b are in disjoint alias sets, but aa-eval reports that they may alias:

Alias sets for function 'foo':
Alias Set Tracker: 2 alias sets for 2 pointer values.
  AliasSet[0x7f9b23d0c510, 1] must alias, Mod       Pointers: (i64* %a, 8)
  AliasSet[0x7f9b23d0c5a0, 1] must alias, Mod       Pointers: (i64* %b, 8)

===== Alias Analysis Evaluator Report =====
  1 Total Alias Queries Performed
  0 no alias responses (0.0%)
  1 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!

What is going on here? Am I doing something wrong?


More information about the llvm-dev mailing list