<div>BasicAA treats it conservatively if used on its own. It<span> will return mayalias for the two pointers.</span></div><div><br></div>TBAA operates based on the guarantee that pointers to different types cannot alias (think C's strict aliasing rules).<br>
Therein lies its power but also its danger, that is, nothing prevents the programmer to write code that violates these rules (That's why we have -fno-strict-aliasing).<div>
<br></div><div>So when basica gives up returning mayalias we query tbaa, which will return - based on strict aliasing rules of our language - noalias.<br>
<br><div>opt -basicaa -print-alias-sets basicaa.ll -S -o -</div><div>Alias Set Tracker: 1 alias sets for 2 pointer values.</div><div> AliasSet[0x109808c90, 2] may alias, Mod Pointers: (i64* %sunkaddr4, 18446744073709551615), (i32* %sunkaddr2, 18446744073709551615)</div>
<div><br></div><div><div>opt -basicaa -tbaa -print-alias-sets basicaa.ll -S -o -</div><div>Alias Set Tracker: 2 alias sets for 2 pointer values.</div><div> AliasSet[0x112d07cf0, 1] must alias, Mod Pointers: (i64* %sunkaddr4, 18446744073709551615)</div>
<div> AliasSet[0x112d07d40, 1] must alias, Mod Pointers: (i32* %sunkaddr2, 18446744073709551615)</div></div><div><br></div><div>define void @basicaatest(%str* %a) {</div><div> %sunkaddr1 = ptrtoint %str* %a to i32</div>
<div> %sunkadd = add i32 %sunkaddr1, 4</div><div> %sunkaddr2 = inttoptr i32 %sunkadd to i32*</div><div> %sunkaddr3 = ptrtoint %str* %a to i32</div><div> %sunkadd2 = add i32 %sunkaddr1, 4</div><div> %sunkaddr4 = inttoptr i32 %sunkadd2 to i64*</div>
<div> store i64 1, i64* %sunkaddr4, !tbaa !0</div><div> store i32 2, i32* %sunkaddr2, !tbaa !2</div><div> ret void</div><div>}</div><div><br></div><div>!0 = metadata !{metadata !"int64", metadata !1}</div><div>
!1 = metadata !{}</div><div>!2 = metadata !{metadata !"int32", metadata !1}</div><div><br></div><div><br></div><div>On Thursday, November 8, 2012, Pranav Bhandarkar wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
2) If the answer to the above is no, then shouldn't basicaa treat the above<br>
conservatively before it looks at TBAA ?<br>
<br>
<br>
Thanks,<br>
Pranav<br>
<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted<br>
by The Linux Foundation<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a>LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div>
</div><span></span><span></span>