<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 20, 2016 at 2:05 PM, Michael Kuperstein 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>The fact two IR values are defined the same way doesn't necessarily imply they are actually the same value.<br></div></div></blockquote><div><br></div><div>Is this true for anything other than memory (mainly curious) ?<br> </div><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><div>e.g.</div><div><br></div><div>%a = load volatile i32, i32* %p</div><div>%b = load volatile i32, i32* %p</div></div></div></blockquote><div><br></div><div>It's worth pointing out these are just missing implicit state that could easily be made explicit.</div><div><br></div><div>IE</div><div><br></div><div>%1 = new heap version</div><div>%a = load volatile i32, i32* %p, %1</div><div><div>%2 = new heap version</div><div>%a = load volatile i32, i32* %p, %2</div></div><div><br></div><div><br></div><div> <br></div><div><div dir="ltr"><div><br></div><div>>As Sanjoy said, though, it should always be legal to optimize all uses of different "freeze(%x)" values to use the same def - this is equivalent to >choosing the same value for all freezes. It's just not necessary to do so.</div><div><br></div><div>So just to be clear (mainly so i can go back to letting y'all hash this out), in value numbering:<br><br></div><div>1. I can value number all freeze operations on the same operand to the same value</div><div> *as long as*</div><div>2. I  replace all freeze values of the same operand with a single one.</div><div><br></div><div>Or am i misunderstanding?<br><br></div><div>If i've got it right, the issue i see with #2 is whether i can hoist freezes or not.</div><div><br></div><div>If not, it may not be possible to cover all uses.</div><div><br></div><div>IE<br><br></div><div>if (a)  {</div><div>  %1 = freeze (%x)</div><div>} else if (b) {</div><div><div>  %2 = freeze (%x)</div></div><div>} else if (c){ </div><div>  %3 = freeze (%x)</div><div>}</div><div><br></div><div>I cannot replace these with a single freeze def without placing a freeze above the if block.</div><div><br></div><div>*If* i need to replace them all with the same freeze def in order to be able to consider them the same value, either i need to be able to hoist them, or i have to assume the freezes have different values, or  this makes value numbering much harder (I basically have to make some implicit state explicit like we do for memoryssa, where the implicit state is "state of the heap".  In this case, i would associate each freeze with a version based on the SSA renaming algorithm, so i knew which freezes i could *ever* replace with other existing freezes).</div><div><br></div><div>Normally the *value* doesn't depend on the location in the IR, and to the degree it does, we try to make that explicit.</div><div><br></div><div>Again, just trying to understand, mainly so i know if i have to care or not.</div><div><br></div></div><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 20, 2016 at 1:58 PM, Krzysztof Parzyszek 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In both of these cases, the expression tree in the IR is going to look like<br>
  == (freeze(%x), freeze(%x))<br>
<br>
The %a and %b are just labels on values, which are defined in the exact same way. How do you differentiate these two?<br>
<br>
If %a = freeze(%x), is %a+1 == %a+1?<br>
<br>
-Krzysztof<span class="gmail-m_4214579993552758747im gmail-m_4214579993552758747HOEnZb"><br>
<br>
<br>
<br>
On 10/20/2016 3:36 PM, Sanjoy Das wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi Krzysztof,<br>
<br>
Krzysztof Parzyszek wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
On 10/18/2016 4:29 PM, Nuno Lopes wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Even %a and %b might not be the same in "%a = freeze(%x), %b =<br>
freeze(%x)" (each freeze returns an arbitrary, but fixed, value).<br>
</blockquote>
<br>
Assume that %x is known to be a poison value and have:<br>
%a = freeze(%x)<br>
%b = freeze(%x)<br>
<br>
Is %a == %a true?<br>
</blockquote>
<br>
Yes, %a is always == %a.  It is a normal SSA value with some unspecific<br>
content.<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Is %a == %b true?<br>
</blockquote>
<br>
Not necessarily; but the compiler can make it true by (consistently)<br>
choosing equal values for %a and %b.<br>
<br>
By consistently I mean it can't fold one instance of %a == %b to true<br>
and fold another instance of %a == %b to false.<br>
<br>
-- Sanjoy<br>
</blockquote>
<br></span><span class="gmail-m_4214579993552758747im gmail-m_4214579993552758747HOEnZb">
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<br></span><div class="gmail-m_4214579993552758747HOEnZb"><div class="gmail-m_4214579993552758747h5">
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></div></div><br></div></div>