<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 13, 2016 at 11:07 AM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Mon, Jun 13, 2016 at 10:04 AM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Mon, Jun 13, 2016 at 9:57 AM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 13, 2016 at 7:35 AM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Sun, Jun 12, 2016 at 10:12 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Sun, Jun 12, 2016 at 9:31 PM, Yichao Yu <span dir="ltr"><<a href="mailto:yyc1992@gmail.com" target="_blank">yyc1992@gmail.com</a>></span> wrote:<span></span><br><span></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>
> Alias analysis results should not be confused with value equivalence (though<br>
> it is common).  MustAlias or NoAlias implies nothing about the actual<br>
> pointer value, only the abstract memory location it represents.<br>
<br>
</span>I can understand they are not equivalent but shouldn't not being the<br>
same pointer value be a necessary condition for NoAlias? In another<br>
word, are the following valid?<br>
<br>
```<br>
define i64 @f1(i64 *%p0, i64 *%p1) {<br>
  store i64 0, i64 *%p0, !tbaa !0<br>
<span>  %v2 = load i64, i64 *%p1, !tbaa !1<br>
</span>  ret %v2<br>
}<br>
<br>
define i64 @f2(i64 *%p1) {<br>
  store i64 0, i64 *%p1, !tbaa !0<br>
<span>  %v2 = load i64, i64 *%p1, !tbaa !1<br>
</span>  ret %v2<br>
}<br>
<br></blockquote><div><br></div></span><div>It depends on what you mean by "valid"... @f1 passed two identical pointers is basically equivalent to "ret i64 undef". </div></div></div></div></blockquote><div><br></div></span><div>So, i can't see anything in the langref that says this.<br></div><div><br></div><div>For f1, the valid things i see you can do are (and have an argument you can)<br><br></div><div>1. move the load before the store, return value of load (IE reorder them)</div><div>2. eliminate both the load and store and return 0 (IE forward the store)</div><div><br></div><div>I don't see a valid path to ret undef. I'm eminently curious what i've missed :)</div><div><br></div></div></div></div>
</blockquote></div><br></div></div></div><div class="gmail_extra">LLVM can turn "store zero" into "store <arbitrary-value>; store zero", then reorder the load between the two stores.<br><br></div></div></blockquote></div></div><div>I have trouble seeing why this would be legal, unless arbitrary value is also zero :)</div><div><br></div><div>The original of the load semantics were either "it loads the value that existed prior to function start", or "it loads the value of the store (zero)".<br></div><div>What you are suggesting is something that changes the semantics to "it loads an arbitrary value".</div></div></div></div></blockquote><div><br></div></div></div><div>Are you saying that the "insert store of arbitrary value" step isn't legal? </div></div></div></div></blockquote><div><br></div><div>I believe so, yes, *if* the effect is to change the semantics of the load.</div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> I mean, it looks silly in a tiny example like this, but I'm not sure why it wouldn't be allowed.  (It's basically equivalent to transforming "*p = *p * 3 + 1;" to "*p *= 3; *p += 1;".)</div></div></div></div></blockquote><div><br></div><div>I would suggest, in this case, it is not legal because it changes the semantics of the load in an observable way.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>-Eli<br></div></font></span></div></div></div>
</blockquote></div><br></div></div>