<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Yep, the typical answer is MustAlias here. You can see this because BasicAA looks through pointer bitcasts, and eventually returns MustAlias when the Value*’s are the same.<div class=""><br class=""></div><div class="">-Chris<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 11, 2019, at 3:14 PM, Philip Reames via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" class="">
<div text="#000000" bgcolor="#FFFFFF" class=""><p class="">I find myself needing to ask a very basic question.
Specifically, what do we expect "must alias" to mean in practice?</p><p class="">Consider a simple example:</p><p class="">load i64, i64* %p<br class="">
%p.i32 = bitcast i64* %p to i32*<br class="">
load i32, i32* %p.i32</p><p class="">Given two memory locations which describe the two memory accesses
of these loads, do we expect that alias analysis returns
MustAlias? That is, when we have two accesses to the same
pointer, but *different* sizes, does that result in MustAlias?</p><p class="">(Just to be clear, MayAlias is clearly a valid answer. I'm
really asking if we can legally return MustAlias for these.)<br class="">
</p><p class="">I would have said up until recently, that the correct result
would be a PartialAlias, not a MustAlias. However, we seem to be
quite consistent about returning MustAlias in cases where we know
the base of the access is common, but don't know the sizes are
equal or even non-zero. <br class="">
</p><p class="">I can see four possible meanings of must alias:<br class="">
</p>
<ol class="">
<li class="">A must alias result indicates that the exact same bits in
memory are accessed by both. (This requires both pointer and
size to be equal at runtime.)<br class="">
</li>
<li class="">A must alias result indicates that *at least one* bit in
memory is accessed by both. (This allows unequal pointers, and
unequal sizes, but not zero sizes.)<br class="">
</li>
<li class="">A must alias result indicates that the two pointers must be
equal when accessed at runtime. (This allows unequal sizes, and
zero sizes, but restricts the pointers to be equal.)<br class="">
</li>
<li class="">A must alias result indicates that *at least one* bit in
memory is accessed by both, unless one of the two accesses has
size 0 at runtime. (This is the weakest.)<br class="">
</li>
</ol><p class="">I'd always thought that (1) was the correct answer, but now I
find myself wondering. From the code, (3) seems to be the closest
match to what we actually implement, but we're not entirely
consistent there either. What do others think?</p><p class="">Philip<br class="">
</p><p class=""><br class="">
</p>
</div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>