<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 25, 2016 at 1:46 PM, Caldarale, Charles R via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> From: llvm-dev [mailto:<a href="mailto:llvm-dev-bounces@lists.llvm.org">llvm-dev-bounces@<wbr>lists.llvm.org</a>] On Behalf Of Hal Finkel via llvm-dev<br>
<span class="">> Subject: Re: [llvm-dev] invariant.load metadata semantics<br>
<br>
</span><span class="">> Alternatively, we might phrase this as: The optimizer may assume that all values loaded<br>
> from a location, where any of the loads are tagged with !invariant.load, are identical.<br>
<br>
</span>This would seem to limit the usefulness of the invariant attribute.  I would expect invariant to indicate that loads reachable from the one marked invariant are guaranteed to read the same value, but that prior ones are not. </blockquote><div><br></div><div>Define "reachable".</div><div><br></div><div>Do you mean there is any path from the load to the new load?<br><br></div><div>If so, what about loop backedges?<br><br></div><div>:)</div><div><br></div><div>This is one of the reasons they are explicitly marked.</div><div><br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> This would allow updates to be made to the location of interest up to the point of declared invariance, but not after.<br></blockquote><div><br></div><div>This has the same problem.</div><div><br></div><div>for loop:<br><br></div><div>  store a</div><div>  load a !invariant.load</div><div><br></div><div><br></div><div>Legal or not if we can prove the loop iterates >1 time?<br>What does it mean?</div></div></div></div>